From cc3b3a145e1790af07acff3494e77c2f31f38bda Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 29 Sep 2016 23:23:02 +0300 Subject: [PATCH] only bump nTimeLast* when valid new/updated message arrived, do not bump on invalid or 'seen' --- src/governance.cpp | 6 +----- src/masternode-payments.cpp | 1 - src/masternodeman.cpp | 10 +++++----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/governance.cpp b/src/governance.cpp index 92fb029aa..e9ad7c6e0 100644 --- a/src/governance.cpp +++ b/src/governance.cpp @@ -140,7 +140,6 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C if(mapSeenGovernanceObjects.count(govobj.GetHash())){ // TODO - print error code? what if it's GOVOBJ_ERROR_IMMATURE? - masternodeSync.AddedBudgetItem(govobj.GetHash()); return; } @@ -189,10 +188,7 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C // IF WE'VE SEEN THIS OBJECT THEN SKIP - if(mapSeenVotes.count(vote.GetHash())){ - masternodeSync.AddedBudgetItem(vote.GetHash()); - return; - } + if(mapSeenVotes.count(vote.GetHash())) return; // FIND THE MASTERNODE OF THE VOTER diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index 97495dbfd..b3b91b64f 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -316,7 +316,6 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, std::string& strCommand, if(mapMasternodePaymentVotes.count(vote.GetHash())) { LogPrint("mnpayments", "MASTERNODEPAYMENTVOTE -- hash=%s, nHeight=%d seen\n", vote.GetHash().ToString(), pCurrentBlockIndex->nHeight); - masternodeSync.AddedPaymentVote(); return; } diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 5e69ae550..10150e057 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -701,7 +701,6 @@ int CMasternodeMan::GetEstimatedMasternodes(int nBlock) void CMasternodeMan::UpdateMasternodeList(CMasternodeBroadcast mnb) { mapSeenMasternodePing.insert(make_pair(mnb.lastPing.GetHash(), mnb.lastPing)); mapSeenMasternodeBroadcast.insert(make_pair(mnb.GetHash(), mnb)); - masternodeSync.AddedMasternodeList(); LogPrintf("CMasternodeMan::UpdateMasternodeList() - addr: %s\n vin: %s\n", mnb.addr.ToString(), mnb.vin.ToString()); @@ -709,9 +708,11 @@ void CMasternodeMan::UpdateMasternodeList(CMasternodeBroadcast mnb) { if(pmn == NULL) { CMasternode mn(mnb); - Add(mn); - } else { - pmn->UpdateFromNewBroadcast(mnb); + if(Add(mn)) { + masternodeSync.AddedMasternodeList(); + } + } else if(pmn->UpdateFromNewBroadcast(mnb)) { + masternodeSync.AddedMasternodeList(); } } @@ -720,7 +721,6 @@ bool CMasternodeMan::CheckMnbAndUpdateMasternodeList(CMasternodeBroadcast mnb, i LogPrint("masternode", "CMasternodeMan::CheckMnbAndUpdateMasternodeList - Masternode broadcast, vin: %s\n", mnb.vin.ToString()); if(mapSeenMasternodeBroadcast.count(mnb.GetHash())) { //seen - masternodeSync.AddedMasternodeList(); return true; } mapSeenMasternodeBroadcast.insert(make_pair(mnb.GetHash(), mnb));