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);
|
voteInstance = vote_instance_t(vote.GetOutcome(), nVoteTimeUpdate);
|
||||||
fileVotes.AddVote(vote);
|
fileVotes.AddVote(vote);
|
||||||
|
mnodeman.AddGovernanceVote(vote.GetVinMasternode(), vote.GetParentHash());
|
||||||
fDirtyCache = true;
|
fDirtyCache = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -219,8 +219,6 @@ void CMasternode::Check(bool fForce)
|
|||||||
nActiveState = MASTERNODE_UPDATE_REQUIRED;
|
nActiveState = MASTERNODE_UPDATE_REQUIRED;
|
||||||
if(nActiveStatePrev != nActiveState) {
|
if(nActiveStatePrev != nActiveState) {
|
||||||
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
|
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
|
||||||
// RESCAN AFFECTED VOTES
|
|
||||||
FlagGovernanceItemsAsDirty();
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -259,8 +257,6 @@ void CMasternode::Check(bool fForce)
|
|||||||
nActiveState = MASTERNODE_NEW_START_REQUIRED;
|
nActiveState = MASTERNODE_NEW_START_REQUIRED;
|
||||||
if(nActiveStatePrev != nActiveState) {
|
if(nActiveStatePrev != nActiveState) {
|
||||||
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
|
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
|
||||||
// RESCAN AFFECTED VOTES
|
|
||||||
FlagGovernanceItemsAsDirty();
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -283,8 +279,6 @@ void CMasternode::Check(bool fForce)
|
|||||||
nActiveState = MASTERNODE_EXPIRED;
|
nActiveState = MASTERNODE_EXPIRED;
|
||||||
if(nActiveStatePrev != nActiveState) {
|
if(nActiveStatePrev != nActiveState) {
|
||||||
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
|
LogPrint("masternode", "CMasternode::Check -- Masternode %s is in %s state now\n", vin.prevout.ToStringShort(), GetStateString());
|
||||||
// RESCAN AFFECTED VOTES
|
|
||||||
FlagGovernanceItemsAsDirty();
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -962,14 +956,6 @@ void CMasternode::UpdateWatchdogVoteTime()
|
|||||||
*/
|
*/
|
||||||
void CMasternode::FlagGovernanceItemsAsDirty()
|
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::vector<uint256> vecDirty;
|
||||||
{
|
{
|
||||||
std::map<uint256, int>::iterator it = mapGovernanceObjectsVotedOn.begin();
|
std::map<uint256, int>::iterator it = mapGovernanceObjectsVotedOn.begin();
|
||||||
|
@ -200,6 +200,7 @@ void CMasternodeMan::CheckAndRemove()
|
|||||||
mWeAskedForMasternodeListEntry.erase((*it).vin.prevout);
|
mWeAskedForMasternodeListEntry.erase((*it).vin.prevout);
|
||||||
|
|
||||||
// and finally remove it from the list
|
// and finally remove it from the list
|
||||||
|
it->FlagGovernanceItemsAsDirty();
|
||||||
it = vMasternodes.erase(it);
|
it = vMasternodes.erase(it);
|
||||||
fMasternodesRemoved = true;
|
fMasternodesRemoved = true;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user