HomePhabricator

net: Avoid duplicate getheaders requests.
f93c2a1b7ee9Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

net: Avoid duplicate getheaders requests.

The current logic for syncing headers may lead to lots of duplicate
getheaders requests being sent: If a new block arrives while the node
is in headers sync, it will send getheaders in response to the block
announcement. When the headers arrive, the message will be of maximum
size and so a follow-up request will be sent---all of that in addition
to the existing headers syncing. This will create a second "chain" of
getheaders requests. If more blocks arrive, this may even lead to
arbitrarily many parallel chains of redundant requests.

This patch changes the behaviour to only request more headers after a
maximum-sized message when it contained at least one unknown header.
This avoids sustaining parallel chains of redundant requests.

Note that this patch avoids the issues raised in the discussion of
https://github.com/bitcoin/bitcoin/pull/6821: There is no risk of the
node being permanently blocked. At the latest when a new block arrives
this will trigger a new getheaders request and restart syncing.

Details

Provenance
Daniel Kraft <d@domob.eu>Authored on May 15 2016, 18:15
schancelPushed on Jan 5 2018, 21:58
schancelPushed on Jan 5 2018, 21:39
schancelPushed on Jan 5 2018, 21:17
Parents
rSTAGING169d379c9835: Merge #8046: [Qt][OSX] Fix Cmd-Q / Menu Quit shutdown on OSX
Branches
Unknown
Tags
Unknown
Reverted By
rSTAGING4fbdc4365ba7: Revert "net: Avoid duplicate getheaders requests." PR #8054