From cc26cff89363a85405c4c57c7726d55ec6ce829f Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 20 Jul 2015 20:38:02 +0300 Subject: [PATCH] do not require active MN on ping check from UpdateFromNewBroadcast --- src/masternode.cpp | 7 ++++--- src/masternode.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/masternode.cpp b/src/masternode.cpp index 4e97c53211..2619c76419 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -140,7 +140,7 @@ void CMasternode::UpdateFromNewBroadcast(CMasternodeBroadcast& mnb) protocolVersion = mnb.protocolVersion; addr = mnb.addr; int nDoS = 0; - if(mnb.lastPing == CMasternodePing() || (mnb.lastPing != CMasternodePing() && mnb.lastPing.CheckAndUpdate(nDoS))) { + if(mnb.lastPing == CMasternodePing() || (mnb.lastPing != CMasternodePing() && mnb.lastPing.CheckAndUpdate(nDoS, false))) { lastPing = mnb.lastPing; mapSeenMasternodePing[lastPing.GetHash()] = lastPing; } @@ -500,7 +500,7 @@ bool CMasternodePing::Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode) return true; } -bool CMasternodePing::CheckAndUpdate(int& nDos) +bool CMasternodePing::CheckAndUpdate(int& nDos, bool fRequireEnabled) { if (sigTime > GetAdjustedTime() + 60 * 60) { LogPrintf("CMasternodePing::CheckAndUpdate - Signature rejected, too far into the future %s\n", vin.ToString().c_str()); @@ -516,7 +516,8 @@ bool CMasternodePing::CheckAndUpdate(int& nDos) // see if we have this Masternode CMasternode* pmn = mnodeman.Find(vin); - if(pmn != NULL && pmn->IsEnabled() && pmn->protocolVersion >= masternodePayments.GetMinMasternodePaymentsProto()) + fRequireEnabled = (fRequireEnabled && pmn->IsEnabled()) || !fRequireEnabled; + if(pmn != NULL && fRequireEnabled && pmn->protocolVersion >= masternodePayments.GetMinMasternodePaymentsProto()) { // LogPrintf("mnping - Found corresponding mn for vin: %s\n", vin.ToString().c_str()); // update only if there is no known ping for this masternode or diff --git a/src/masternode.h b/src/masternode.h index 0cf4aa673e..77fedc99de 100644 --- a/src/masternode.h +++ b/src/masternode.h @@ -57,7 +57,7 @@ public: READWRITE(vchSig); } - bool CheckAndUpdate(int& nDos); + bool CheckAndUpdate(int& nDos, bool fRequireEnabled = true); bool Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode); void Relay();