Merge pull request #454 from UdjinM6/v0.12.0.x_fix_sync

V0.12.0.x remove sync forcing and count already seen as a success instead
This commit is contained in:
evan82 2015-07-24 16:03:27 -07:00
commit 50121bbf69
5 changed files with 39 additions and 34 deletions

View File

@ -3964,17 +3964,41 @@ bool static AlreadyHave(const CInv& inv)
case MSG_SPORK:
return mapSporks.count(inv.hash);
case MSG_MASTERNODE_WINNER:
return masternodePayments.mapMasternodePayeeVotes.count(inv.hash);
if(masternodePayments.mapMasternodePayeeVotes.count(inv.hash)) {
masternodeSync.AddedMasternodeWinner();
return true;
}
return false;
case MSG_BUDGET_VOTE:
return mapSeenMasternodeBudgetVotes.count(inv.hash);
if(mapSeenMasternodeBudgetVotes.count(inv.hash)) {
masternodeSync.AddedBudgetItem();
return true;
}
return false;
case MSG_BUDGET_PROPOSAL:
return mapSeenMasternodeBudgetProposals.count(inv.hash);
if(mapSeenMasternodeBudgetProposals.count(inv.hash)) {
masternodeSync.AddedBudgetItem();
return true;
}
return false;
case MSG_BUDGET_FINALIZED_VOTE:
return mapSeenFinalizedBudgetVotes.count(inv.hash);
if(mapSeenFinalizedBudgetVotes.count(inv.hash)) {
masternodeSync.AddedBudgetItem();
return true;
}
return false;
case MSG_BUDGET_FINALIZED:
return mapSeenFinalizedBudgets.count(inv.hash);
if(mapSeenFinalizedBudgets.count(inv.hash)) {
masternodeSync.AddedBudgetItem();
return true;
}
return false;
case MSG_MASTERNODE_ANNOUNCE:
return mapSeenMasternodeBroadcast.count(inv.hash);
if(mapSeenMasternodeBroadcast.count(inv.hash)) {
masternodeSync.AddedMasternodeList();
return true;
}
return false;
case MSG_MASTERNODE_PING:
return mapSeenMasternodePing.count(inv.hash);
}

View File

@ -790,6 +790,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
vRecv >> budgetProposalBroadcast;
if(mapSeenMasternodeBudgetProposals.count(budgetProposalBroadcast.GetHash())){
masternodeSync.AddedBudgetItem();
return;
}
@ -819,6 +820,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
vote.fValid = true;
if(mapSeenMasternodeBudgetVotes.count(vote.GetHash())){
masternodeSync.AddedBudgetItem();
return;
}
@ -852,6 +854,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
vRecv >> finalizedBudgetBroadcast;
if(mapSeenFinalizedBudgets.count(finalizedBudgetBroadcast.GetHash())){
masternodeSync.AddedBudgetItem();
return;
}
@ -883,6 +886,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
vote.fValid = true;
if(mapSeenFinalizedBudgetVotes.count(vote.GetHash())){
masternodeSync.AddedBudgetItem();
return;
}

View File

@ -364,6 +364,7 @@ void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::st
if(masternodePayments.mapMasternodePayeeVotes.count(winner.GetHash())){
if(fDebug) LogPrintf("mnw - Already seen - %s bestHeight %d\n", winner.GetHash().ToString().c_str(), chainActive.Tip()->nHeight);
masternodeSync.AddedMasternodeWinner();
return;
}

View File

@ -147,14 +147,6 @@ void CMasternodeSync::Process()
return;
}
// If it's already more then MASTERNODE_SYNC_TIMEOUT seconds passed since we asked
// and we still have nothing, assume there is nothing to sync but give it another
// MASTERNODE_SYNC_TIMEOUT seconds until we move further
static int64_t lastTimeAsked = 0;
if(lastMasternodeList == 0 && lastTimeAsked > 0 && lastTimeAsked < GetTime() - MASTERNODE_SYNC_TIMEOUT) {
lastMasternodeList = GetTime();
}
if(pnode->HasFulfilledRequest("mnsync")) continue;
pnode->FulfilledRequest("mnsync");
@ -162,7 +154,6 @@ void CMasternodeSync::Process()
&& RequestedMasternodeAttempt <= 2){
mnodeman.DsegUpdate(pnode);
RequestedMasternodeAttempt++;
lastTimeAsked = GetTime();
}
return;
}
@ -173,14 +164,6 @@ void CMasternodeSync::Process()
return;
}
// If it's already more then MASTERNODE_SYNC_TIMEOUT seconds passed since we asked
// and we still have nothing, assume there is nothing to sync but give it another
// MASTERNODE_SYNC_TIMEOUT seconds until we move further
static int64_t lastTimeAsked = 0;
if(lastMasternodeWinner == 0 && lastTimeAsked > 0 && lastTimeAsked < GetTime() - MASTERNODE_SYNC_TIMEOUT) {
lastMasternodeWinner = GetTime();
}
if(pnode->HasFulfilledRequest("mnwsync")) continue;
pnode->FulfilledRequest("mnwsync");
@ -193,7 +176,6 @@ void CMasternodeSync::Process()
int nMnCount = mnodeman.CountEnabled()*2;
pnode->PushMessage("mnget", nMnCount); //sync payees
RequestedMasternodeAttempt++;
lastTimeAsked = GetTime();
}
return;
}
@ -207,14 +189,6 @@ void CMasternodeSync::Process()
return;
}
// If it's already more then MASTERNODE_SYNC_TIMEOUT seconds passed since we asked
// and we still have nothing, assume there is nothing to sync but give it another
// MASTERNODE_SYNC_TIMEOUT seconds until we move further
static int64_t lastTimeAsked = 0;
if(lastBudgetItem == 0 && lastTimeAsked > 0 && lastTimeAsked < GetTime() - MASTERNODE_SYNC_TIMEOUT) {
lastBudgetItem = GetTime();
}
if(pnode->HasFulfilledRequest("busync")) continue;
pnode->FulfilledRequest("busync");
@ -223,7 +197,6 @@ void CMasternodeSync::Process()
uint256 n = 0;
pnode->PushMessage("mnvs", n); //sync masternode votes
RequestedMasternodeAttempt++;
lastTimeAsked = GetTime();
}
return;
}

View File

@ -617,7 +617,10 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
CMasternodeBroadcast mnb;
vRecv >> mnb;
if(mapSeenMasternodeBroadcast.count(mnb.GetHash())) return; //seen
if(mapSeenMasternodeBroadcast.count(mnb.GetHash())) { //seen
masternodeSync.AddedMasternodeList();
return;
}
mapSeenMasternodeBroadcast[mnb.GetHash()] = mnb;
int nDoS = 0;