changes in CMasternode::Check (#1194)

* add log output when mn state changes (debug mode only)

* trigger FlagGovernanceItemsAsDirty only when mn state actually changes
This commit is contained in:
UdjinM6 2016-12-06 23:50:54 +04:00 committed by GitHub
parent 3914f4a1c4
commit 32ab9f2624

View File

@ -210,6 +210,8 @@ void CMasternode::Check(bool fForce)
return; return;
} }
int nActiveStatePrev = nActiveState;
// masternode doesn't meet payment protocol requirements ... // masternode doesn't meet payment protocol requirements ...
bool fRemove = nProtocolVersion < mnpayments.GetMinMasternodePaymentsProto() || bool fRemove = nProtocolVersion < mnpayments.GetMinMasternodePaymentsProto() ||
// or it's our own node and we just updated it to the new protocol but we are still waiting for activation ... // or it's our own node and we just updated it to the new protocol but we are still waiting for activation ...
@ -218,9 +220,11 @@ void CMasternode::Check(bool fForce)
if(fRemove) { if(fRemove) {
// it should be removed from the list // it should be removed from the list
nActiveState = MASTERNODE_REMOVE; nActiveState = MASTERNODE_REMOVE;
if(nActiveStatePrev != nActiveState) {
// RESCAN AFFECTED VOTES LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
FlagGovernanceItemsAsDirty(); // RESCAN AFFECTED VOTES
FlagGovernanceItemsAsDirty();
}
return; return;
} }
@ -232,6 +236,9 @@ void CMasternode::Check(bool fForce)
if(fWatchdogExpired) { if(fWatchdogExpired) {
nActiveState = MASTERNODE_WATCHDOG_EXPIRED; nActiveState = MASTERNODE_WATCHDOG_EXPIRED;
if(nActiveStatePrev != nActiveState) {
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
}
return; return;
} }
@ -243,17 +250,26 @@ void CMasternode::Check(bool fForce)
if(!fWaitForPing && !IsPingedWithin(MASTERNODE_EXPIRATION_SECONDS)) { if(!fWaitForPing && !IsPingedWithin(MASTERNODE_EXPIRATION_SECONDS)) {
nActiveState = MASTERNODE_EXPIRED; nActiveState = MASTERNODE_EXPIRED;
// RESCAN AFFECTED VOTES if(nActiveStatePrev != nActiveState) {
FlagGovernanceItemsAsDirty(); LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
// RESCAN AFFECTED VOTES
FlagGovernanceItemsAsDirty();
}
return; return;
} }
if(lastPing.sigTime - sigTime < MASTERNODE_MIN_MNP_SECONDS) { if(lastPing.sigTime - sigTime < MASTERNODE_MIN_MNP_SECONDS) {
nActiveState = MASTERNODE_PRE_ENABLED; nActiveState = MASTERNODE_PRE_ENABLED;
if(nActiveStatePrev != nActiveState) {
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
}
return; return;
} }
nActiveState = MASTERNODE_ENABLED; // OK nActiveState = MASTERNODE_ENABLED; // OK
if(nActiveStatePrev != nActiveState) {
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
}
} }
bool CMasternode::IsValidNetAddr() bool CMasternode::IsValidNetAddr()