From 7c45e62357dfa7420b6e6ca15594a9652378be6a Mon Sep 17 00:00:00 2001 From: kanon <60179867+decryp2kanon@users.noreply.github.com> Date: Mon, 11 May 2020 17:32:09 +0900 Subject: [PATCH] revert (#78) & fix: disabled more getheaders (#126) * revert&fix: disabled more getheaders * remove: printf --- src/net_processing.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 4bebd1382..dd95c35cd 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1398,16 +1398,14 @@ bool static ProcessHeadersMessage(CNode *pfrom, CConnman *connman, const std::ve } // FIXME.SUGAR - // 120x bitcoin // IBD: disable additional download during IBD, due to too much traffic - /* - if (nCount == MAX_HEADERS_RESULTS) { + // IBD: reduce frequency of additional downloading during IBD, against too much traffic + if (nCount == MAX_HEADERS_RESULTS && (pindexLast->nHeight) % (MAX_HEADERS_RESULTS * 2) == 0) { // Headers message had its maximum size; the peer may have more headers. // TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue // from there instead. LogPrint(BCLog::NET, "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->GetId(), pfrom->nStartingHeight); connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::GETHEADERS, chainActive.GetLocator(pindexLast), uint256())); } - */ bool fCanDirectFetch = CanDirectFetch(chainparams.GetConsensus()); // If this set of headers is valid and ends in a block with at least as