Only ask for missing masternodes/budget items after sync is complete

This commit is contained in:
Evan Duffield 2015-07-17 11:03:49 -07:00
parent f9ada02a7d
commit d5c4f3bea4
2 changed files with 12 additions and 0 deletions

View File

@ -967,6 +967,10 @@ bool CBudgetManager::UpdateProposal(CBudgetVote& vote, CNode* pfrom)
if(!mapProposals.count(vote.nProposalHash)){ if(!mapProposals.count(vote.nProposalHash)){
if(pfrom){ if(pfrom){
// only ask for missing items after our syncing process is complete --
// otherwise we'll think a full sync succeeded when they return a result
if(!masternodeSync.IsSynced()) return false;
LogPrintf("CBudgetManager::UpdateProposal - Unknown proposal %d, asking for source proposal\n", vote.nProposalHash.ToString()); LogPrintf("CBudgetManager::UpdateProposal - Unknown proposal %d, asking for source proposal\n", vote.nProposalHash.ToString());
mapOrphanMasternodeBudgetVotes[vote.nProposalHash] = vote; mapOrphanMasternodeBudgetVotes[vote.nProposalHash] = vote;
@ -990,6 +994,10 @@ bool CBudgetManager::UpdateFinalizedBudget(CFinalizedBudgetVote& vote, CNode* pf
if(!mapFinalizedBudgets.count(vote.nBudgetHash)){ if(!mapFinalizedBudgets.count(vote.nBudgetHash)){
if(pfrom){ if(pfrom){
// only ask for missing items after our syncing process is complete --
// otherwise we'll think a full sync succeeded when they return a result
if(!masternodeSync.IsSynced()) return false;
LogPrintf("CBudgetManager::UpdateFinalizedBudget - Unknown Finalized Proposal %s, asking for source budget\n", vote.nBudgetHash.ToString()); LogPrintf("CBudgetManager::UpdateFinalizedBudget - Unknown Finalized Proposal %s, asking for source budget\n", vote.nBudgetHash.ToString());
mapOrphanFinalizedBudgetVotes[vote.nBudgetHash] = vote; mapOrphanFinalizedBudgetVotes[vote.nBudgetHash] = vote;

View File

@ -630,6 +630,10 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
return; return;
} }
// only ask for missing items after our syncing process is complete --
// otherwise we'll think a full sync succeeded when they return a result
if(!masternodeSync.IsSynced()) return;
// we wasn't able to accept mnp but nothing significant happened, // we wasn't able to accept mnp but nothing significant happened,
// we might just have to ask for a masternode entry once // we might just have to ask for a masternode entry once
std::map<COutPoint, int64_t>::iterator i = mWeAskedForMasternodeListEntry.find(mnp.vin.prevout); std::map<COutPoint, int64_t>::iterator i = mWeAskedForMasternodeListEntry.find(mnp.vin.prevout);