Only process orphan votes once

This commit is contained in:
Tim Flynn 2016-11-14 13:22:50 -05:00
parent 08e977efe5
commit d167772643

View File

@ -618,7 +618,7 @@ bool CGovernanceManager::ProcessVote(CNode* pfrom, const CGovernanceVote& vote,
uint256 nHashGovobj = vote.GetParentHash();
object_m_it it = mapObjects.find(nHashGovobj);
if(it == mapObjects.end()) {
mapOrphanVotes.Insert(nHashGovobj, vote);
if(mapOrphanVotes.Insert(nHashGovobj, vote)) {
RequestGovernanceObject(pfrom, nHashGovobj);
std::ostringstream ostr;
ostr << "CGovernanceManager::ProcessVote -- Unknown parent object "
@ -626,6 +626,7 @@ bool CGovernanceManager::ProcessVote(CNode* pfrom, const CGovernanceVote& vote,
<< ", governance object hash = " << vote.GetParentHash().ToString() << "\n";
LogPrintf(ostr.str().c_str());
exception = CGovernanceException(ostr.str(), GOVERNANCE_EXCEPTION_WARNING);
}
return false;
}
@ -814,7 +815,7 @@ bool CGovernanceObject::ProcessVote(CNode* pfrom,
{
int nMNIndex = governance.GetMasternodeIndex(vote.GetVinMasternode());
if(nMNIndex < 0) {
mapOrphanVotes.Insert(vote.GetVinMasternode(), vote);
if(mapOrphanVotes.Insert(vote.GetVinMasternode(), vote)) {
if(pfrom) {
mnodeman.AskForMN(pfrom, vote.GetVinMasternode());
}
@ -822,6 +823,7 @@ bool CGovernanceObject::ProcessVote(CNode* pfrom,
ostr << "CGovernanceObject::UpdateVote -- Masternode index not found\n";
LogPrintf(ostr.str().c_str());
exception = CGovernanceException(ostr.str(), GOVERNANCE_EXCEPTION_WARNING);
}
return false;
}