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;
|
||||
votehash = vote.GetParentHash();
|
||||
mapAskedForGovernanceObject[vote.GetParentHash()] = GetTime();
|
||||
}
|
||||
}
|
||||
|
||||
strError = "Governance object not found!";
|
||||
} else {
|
||||
strError = "Governance object not found! Sync message has been already pushed.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Need to keep this out of the locked section
|
||||
if(syncparent) {
|
||||
pfrom->PushMessage(NetMsgType::MNGOVERNANCESYNC, votehash);
|
||||
strError = "Governance object not found! Sync message was pushed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reestablish lock
|
||||
|
Loading…
Reference in New Issue
Block a user