Governance masternode notification bug fixes (#1270)

* Flag governance items when MN's are removed

* Remove old broken update mechanism

* Do not flag MN state changes which are irrelevant to validity

* Call AddGovernanceVote
This commit is contained in:
Tim Flynn 2017-01-18 10:24:19 -05:00 committed by UdjinM6
parent 5254255a0a
commit 4b7bd6be8f
3 changed files with 2 additions and 14 deletions

View File

@ -170,6 +170,7 @@ bool CGovernanceObject::ProcessVote(CNode* pfrom,
}
voteInstance = vote_instance_t(vote.GetOutcome(), nVoteTimeUpdate);
fileVotes.AddVote(vote);
mnodeman.AddGovernanceVote(vote.GetVinMasternode(), vote.GetParentHash());
fDirtyCache = true;
return true;
}

View File

@ -219,8 +219,6 @@ void CMasternode::Check(bool fForce)
nActiveState = MASTERNODE_UPDATE_REQUIRED;
if(nActiveStatePrev != nActiveState) {
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
// RESCAN AFFECTED VOTES
FlagGovernanceItemsAsDirty();
}
return;
}
@ -259,8 +257,6 @@ void CMasternode::Check(bool fForce)
nActiveState = MASTERNODE_NEW_START_REQUIRED;
if(nActiveStatePrev != nActiveState) {
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
// RESCAN AFFECTED VOTES
FlagGovernanceItemsAsDirty();
}
return;
}
@ -283,8 +279,6 @@ void CMasternode::Check(bool fForce)
nActiveState = MASTERNODE_EXPIRED;
if(nActiveStatePrev != nActiveState) {
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
// RESCAN AFFECTED VOTES
FlagGovernanceItemsAsDirty();
}
return;
}
@ -962,14 +956,6 @@ void CMasternode::UpdateWatchdogVoteTime()
*/
void CMasternode::FlagGovernanceItemsAsDirty()
{
std::map<uint256, int>::iterator it = mapGovernanceObjectsVotedOn.begin();
while(it != mapGovernanceObjectsVotedOn.end()){
CGovernanceObject *pObj = governance.FindGovernanceObject((*it).first);
if(pObj) pObj->InvalidateVoteCache();
++it;
}
std::vector<uint256> vecDirty;
{
std::map<uint256, int>::iterator it = mapGovernanceObjectsVotedOn.begin();

View File

@ -200,6 +200,7 @@ void CMasternodeMan::CheckAndRemove()
mWeAskedForMasternodeListEntry.erase((*it).vin.prevout);
// and finally remove it from the list
it->FlagGovernanceItemsAsDirty();
it = vMasternodes.erase(it);
fMasternodesRemoved = true;
} else {