From bc3b349cc1612a6269d42429e949ad0c80251878 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 2 Dec 2016 21:42:45 +0400 Subject: [PATCH] expired masternodes should not be auto-re-enabled on start, should keep expired state (#1182) --- src/masternode.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/masternode.cpp b/src/masternode.cpp index dadd2c75ca..8c90538a5c 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -195,10 +195,6 @@ void CMasternode::Check(bool fForce) nHeight = chainActive.Height(); } - // keep old masternodes on start, give them a chance to receive an updated ping without removal/expiry - if(!masternodeSync.IsMasternodeListSynced()) nTimeStart = GetTime(); - bool fWaitForPing = (GetTime() - nTimeStart < MASTERNODE_MIN_MNP_SECONDS); - if(nActiveState == MASTERNODE_POSE_BAN) { if(nHeight < nPoSeBanHeight) return; // too early? // Otherwise give it a chance to proceed further to do all the usual checks and to change its state. @@ -239,6 +235,12 @@ void CMasternode::Check(bool fForce) return; } + // keep old masternodes on start, give them a chance to receive an updated ping without removal/expiry + if(!masternodeSync.IsMasternodeListSynced()) nTimeStart = GetTime(); + bool fWaitForPing = (GetTime() - nTimeStart < MASTERNODE_MIN_MNP_SECONDS); + // but if it was already expired before the check - don't wait, check it again now + if(nActiveState == MASTERNODE_EXPIRED) fWaitForPing = false; + if(!fWaitForPing && !IsPingedWithin(MASTERNODE_EXPIRATION_SECONDS)) { nActiveState = MASTERNODE_EXPIRED; // RESCAN AFFECTED VOTES