Governance: Fix governance object syncing in AddOrUpdateVote. (#1061)
There is a bug AddOrUpdateVote function in CGovernanceManager. If a new vote has been arrived it is checked if a corresponding parent object are present in the mapObjects. If it is not we need to sync the parent object and return false. But the syncing is never performed because the corresponding code is placed after return statement. So we need to sync and then return.
This commit is contained in:
parent
81c3ccbdf8
commit
d537610047
@ -510,17 +510,19 @@ bool CGovernanceManager::AddOrUpdateVote(const CGovernanceVote& vote, CNode* pfr
|
|||||||
syncparent = true;
|
syncparent = true;
|
||||||
votehash = vote.GetParentHash();
|
votehash = vote.GetParentHash();
|
||||||
mapAskedForGovernanceObject[vote.GetParentHash()] = GetTime();
|
mapAskedForGovernanceObject[vote.GetParentHash()] = GetTime();
|
||||||
}
|
} else {
|
||||||
}
|
strError = "Governance object not found! Sync message has been already pushed.";
|
||||||
|
|
||||||
strError = "Governance object not found!";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Need to keep this out of the locked section
|
// Need to keep this out of the locked section
|
||||||
if(syncparent) {
|
if(syncparent) {
|
||||||
pfrom->PushMessage(NetMsgType::MNGOVERNANCESYNC, votehash);
|
pfrom->PushMessage(NetMsgType::MNGOVERNANCESYNC, votehash);
|
||||||
|
strError = "Governance object not found! Sync message was pushed.";
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reestablish lock
|
// Reestablish lock
|
||||||
|
Loading…
Reference in New Issue
Block a user