Skip to content

Commit 474a676

Browse files
FornaxACevap
authored andcommitted
Merged in avoid-stalling-legacy-sync (pull request dashpay#48)
[FIX] Avoid stalling and slow legacy nodes during IBD Approved-by: Cevap
2 parents 1778858 + 06f807e commit 474a676

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/net_processing.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,6 +2162,9 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
21622162
std::vector<CInv> vInv(1);
21632163
vInv[0] = CInv(MSG_BLOCK, inv.hash);
21642164
connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::GETDATA, vInv));
2165+
2166+
state->nStallingSince = GetTimeMicros();
2167+
LogPrint(BCLog::NET, "Stall started peer=%s\n", state->name);
21652168
}
21662169
// Download if this is a nice peer, or we have no nice peers and this one might do.
21672170
bool fFetch = state->fPreferredDownload || (nPreferredDownload == 0 && !pfrom->fOneShot);
@@ -2918,6 +2921,8 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
29182921
if (mapBlockIndex.find(pblock->hashPrevBlock) == mapBlockIndex.end()) {
29192922
connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::GETBLOCKS, chainActive.GetLocator(pindexBestHeader), pblock->GetHash()));
29202923
return true;
2924+
} else {
2925+
State(pfrom->GetId())->nStallingSince = 0;
29212926
}
29222927
forceProcessing = true;
29232928
}

0 commit comments

Comments
 (0)