Skip to content

Commit a07dee4

Browse files
committed
[Cleanup] Remove redundant and unused code
`SPORK_10_MASTERNODE_PAY_UPDATED_NODES` has remained active for the past 3+ years through multiple protocol updates and was largely already deprecated at the time we code-forked from DASH. Since the masternode broadcast message was introduced, the only remaining practical use of SPORK_10 was a redundant if/else that this PR removes. Additionally, since the masternode broadcast message was introduced, we no longer need to continue supporting the already deprecated `dsee` and `dseep` network messages, which were themselves only ever used when SPORK_10 was inactive.
1 parent 976f46d commit a07dee4

File tree

7 files changed

+1
-363
lines changed

7 files changed

+1
-363
lines changed

src/activemasternode.cpp

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -199,38 +199,6 @@ bool CActiveMasternode::SendMasternodePing(std::string& errorMessage)
199199

200200
mnp.Relay();
201201

202-
/*
203-
* IT'S SAFE TO REMOVE THIS IN FURTHER VERSIONS
204-
* AFTER MIGRATION TO V12 IS DONE
205-
*/
206-
207-
if (sporkManager.IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES)) return true;
208-
// for migration purposes ping our node on old masternodes network too
209-
std::string retErrorMessage;
210-
std::vector<unsigned char> vchMasterNodeSignature;
211-
int64_t masterNodeSignatureTime = GetAdjustedTime();
212-
213-
std::string strMessage = service.ToString() + std::to_string(masterNodeSignatureTime) + std::to_string(false);
214-
215-
if (!CMessageSigner::SignMessage(strMessage, vchMasterNodeSignature, keyMasternode)) {
216-
errorMessage = "dseep sign message failed.";
217-
return false;
218-
}
219-
220-
if (!CMessageSigner::VerifyMessage(pubKeyMasternode, vchMasterNodeSignature, strMessage, retErrorMessage)) {
221-
errorMessage = "dseep verify message failed: " + retErrorMessage;
222-
return false;
223-
}
224-
225-
LogPrint("masternode", "dseep - relaying from active mn, %s \n", vin.ToString().c_str());
226-
LOCK(cs_vNodes);
227-
for (CNode* pnode : vNodes)
228-
pnode->PushMessage("dseep", vin, vchMasterNodeSignature, masterNodeSignatureTime, false);
229-
230-
/*
231-
* END OF "REMOVE"
232-
*/
233-
234202
return true;
235203
} else {
236204
// Seems like we are trying to send a ping while the Masternode is not registered in the network
@@ -307,44 +275,6 @@ bool CActiveMasternode::CreateBroadcast(CTxIn vin, CService service, CKey keyCol
307275
return false;
308276
}
309277

310-
/*
311-
* IT'S SAFE TO REMOVE THIS IN FURTHER VERSIONS
312-
* AFTER MIGRATION TO V12 IS DONE
313-
*/
314-
315-
if (sporkManager.IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES)) return true;
316-
// for migration purposes inject our node in old masternodes' list too
317-
std::string retErrorMessage;
318-
std::vector<unsigned char> vchMasterNodeSignature;
319-
int64_t masterNodeSignatureTime = GetAdjustedTime();
320-
std::string donationAddress = "";
321-
int donationPercantage = 0;
322-
323-
std::string vchPubKey(pubKeyCollateralAddress.begin(), pubKeyCollateralAddress.end());
324-
std::string vchPubKey2(pubKeyMasternode.begin(), pubKeyMasternode.end());
325-
326-
std::string strMessage = service.ToString() + std::to_string(masterNodeSignatureTime) + vchPubKey + vchPubKey2 + std::to_string(PROTOCOL_VERSION) + donationAddress + std::to_string(donationPercantage);
327-
328-
if (!CMessageSigner::SignMessage(strMessage, vchMasterNodeSignature, keyCollateralAddress)) {
329-
errorMessage = "dsee sign message failed.";
330-
LogPrintf("CActiveMasternode::Register() - Error: %s\n", errorMessage.c_str());
331-
return false;
332-
}
333-
334-
if (!CMessageSigner::VerifyMessage(pubKeyCollateralAddress, vchMasterNodeSignature, strMessage, retErrorMessage)) {
335-
errorMessage = "dsee verify message failed: " + retErrorMessage;
336-
LogPrintf("CActiveMasternode::Register() - Error: %s\n", errorMessage.c_str());
337-
return false;
338-
}
339-
340-
LOCK(cs_vNodes);
341-
for (CNode* pnode : vNodes)
342-
pnode->PushMessage("dsee", vin, service, vchMasterNodeSignature, masterNodeSignatureTime, pubKeyCollateralAddress, pubKeyMasternode, -1, -1, masterNodeSignatureTime, PROTOCOL_VERSION, donationAddress, donationPercantage);
343-
344-
/*
345-
* END OF "REMOVE"
346-
*/
347-
348278
return true;
349279
}
350280

src/masternode-payments.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,7 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int64_t nFe
411411

412412
int CMasternodePayments::GetMinMasternodePaymentsProto()
413413
{
414-
if (sporkManager.IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES))
415-
return ActiveProtocol(); // Allow only updated peers
416-
else
417-
return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT; // Also allow old peers as long as they are allowed to run
414+
return ActiveProtocol();
418415
}
419416

420417
void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)

src/masternode.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ CMasternode::CMasternode() :
7777
nScanningErrorCount = 0;
7878
nLastScanningErrorBlockHeight = 0;
7979
lastTimeChecked = 0;
80-
nLastDsee = 0; // temporary, do not save. Remove after migration to v12
81-
nLastDseep = 0; // temporary, do not save. Remove after migration to v12
8280
}
8381

8482
CMasternode::CMasternode(const CMasternode& other) :
@@ -102,8 +100,6 @@ CMasternode::CMasternode(const CMasternode& other) :
102100
nScanningErrorCount = other.nScanningErrorCount;
103101
nLastScanningErrorBlockHeight = other.nLastScanningErrorBlockHeight;
104102
lastTimeChecked = 0;
105-
nLastDsee = other.nLastDsee; // temporary, do not save. Remove after migration to v12
106-
nLastDseep = other.nLastDseep; // temporary, do not save. Remove after migration to v12
107103
}
108104

109105
uint256 CMasternode::GetSignatureHash() const

src/masternode.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ class CMasternode : public CSignedMessage
146146
int nLastScanningErrorBlockHeight;
147147
CMasternodePing lastPing;
148148

149-
int64_t nLastDsee; // temporary, do not save. Remove after migration to v12
150-
int64_t nLastDseep; // temporary, do not save. Remove after migration to v12
151-
152149
CMasternode();
153150
CMasternode(const CMasternode& other);
154151

0 commit comments

Comments
 (0)