diff options
author | Gregory Maxwell <greg@xiph.org> | 2016-07-05 20:45:14 +0000 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2016-07-05 20:45:14 +0000 |
commit | 4fbdc4365ba73e6947dd9052b28818a4a99c0d64 (patch) | |
tree | 3a92f2fdb33c3b45dd303aa62bb556aef6c65ef0 | |
parent | 115735d547fdeade822f547eb3e8c8f9961a9b07 (diff) |
Revert "net: Avoid duplicate getheaders requests." PR #8054
This reverts commit f93c2a1b7ee912f0651ebb4c8a5eca220e434f4a.
This can cause synchronization to get stuck.
-rw-r--r-- | src/main.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp index 6cdd55e397..e26a73bc4b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5835,13 +5835,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, return true; } - // If we already know the last header in the message, then it contains - // no new information for us. In this case, we do not request - // more headers later. This prevents multiple chains of redundant - // getheader requests from running in parallel if triggered by incoming - // blocks while the node is still in initial headers sync. - const bool hasNewHeaders = (mapBlockIndex.count(headers.back().GetHash()) == 0); - CBlockIndex *pindexLast = NULL; BOOST_FOREACH(const CBlockHeader& header, headers) { CValidationState state; @@ -5862,7 +5855,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, assert(pindexLast); UpdateBlockAvailability(pfrom->GetId(), pindexLast->GetBlockHash()); - if (nCount == MAX_HEADERS_RESULTS && hasNewHeaders) { + if (nCount == MAX_HEADERS_RESULTS) { // 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. |