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:
parent
5254255a0a
commit
4b7bd6be8f
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user