Changed log message handling due to code review suggestion

This commit is contained in:
Tim Flynn 2016-11-14 15:26:53 -05:00
parent d167772643
commit 31370decd7

View File

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