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:
dkaidalov 2016-10-07 19:15:39 +03:00 committed by UdjinM6
parent 81c3ccbdf8
commit d537610047

View File

@ -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