From f995a264e2b4f68a3917b7a4b18705be47196206 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 15 Jan 2017 02:29:08 +0400 Subject: [PATCH] Do not try to check or verify mns until synced to some stage (#1261) Verification creates new conections, which we also use to sync but then we disconnect on ProcessMasternodeConnections every minute which at least could lead to excessive node load (for our peers). But could also interfere with sync process itself and we'd better keep them separate. --- src/masternodeman.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 2ffb27bcf..58d92927e 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -173,8 +173,9 @@ void CMasternodeMan::Check() void CMasternodeMan::CheckAndRemove() { - LogPrintf("CMasternodeMan::CheckAndRemove\n"); + if(!masternodeSync.IsMasternodeListSynced()) return; + LogPrintf("CMasternodeMan::CheckAndRemove\n"); { // Need LOCK2 here to ensure consistent locking order because code below locks cs_main @@ -202,7 +203,12 @@ void CMasternodeMan::CheckAndRemove() it = vMasternodes.erase(it); fMasternodesRemoved = true; } else { - if(pCurrentBlockIndex && !fAskedForMnbRecovery && it->IsNewStartRequired() && !IsMnbRecoveryRequested(hash)) { + bool fAsk = pCurrentBlockIndex && + !fAskedForMnbRecovery && + masternodeSync.IsSynced() && + it->IsNewStartRequired() && + !IsMnbRecoveryRequested(hash); + if(fAsk) { // this mn is in a non-recoverable state and we haven't asked other nodes yet std::set setRequested; // calulate only once and only when it's needed @@ -919,6 +925,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData void CMasternodeMan::DoFullVerificationStep() { if(activeMasternode.vin == CTxIn()) return; + if(!masternodeSync.IsSynced()) return; std::vector > vecMasternodeRanks = GetMasternodeRanks(pCurrentBlockIndex->nHeight - 1, MIN_POSE_PROTO_VERSION);