Skip to content

Commit 005d3b6

Browse files
committed
Merge #8306: Revert "net: Avoid duplicate getheaders requests." PR #8054
4fbdc43 Revert "net: Avoid duplicate getheaders requests." PR #8054 (Gregory Maxwell)
2 parents 115735d + 4fbdc43 commit 005d3b6

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/main.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5835,13 +5835,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
58355835
return true;
58365836
}
58375837

5838-
// If we already know the last header in the message, then it contains
5839-
// no new information for us. In this case, we do not request
5840-
// more headers later. This prevents multiple chains of redundant
5841-
// getheader requests from running in parallel if triggered by incoming
5842-
// blocks while the node is still in initial headers sync.
5843-
const bool hasNewHeaders = (mapBlockIndex.count(headers.back().GetHash()) == 0);
5844-
58455838
CBlockIndex *pindexLast = NULL;
58465839
BOOST_FOREACH(const CBlockHeader& header, headers) {
58475840
CValidationState state;
@@ -5862,7 +5855,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
58625855
assert(pindexLast);
58635856
UpdateBlockAvailability(pfrom->GetId(), pindexLast->GetBlockHash());
58645857

5865-
if (nCount == MAX_HEADERS_RESULTS && hasNewHeaders) {
5858+
if (nCount == MAX_HEADERS_RESULTS) {
58665859
// Headers message had its maximum size; the peer may have more headers.
58675860
// TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue
58685861
// from there instead.

0 commit comments

Comments
 (0)