Page MenuHomePhabricator

Don't send getheaders message when another request is outstanding
ClosedPublic

Authored by PiRK on Dec 5 2023, 12:42.

Details

Summary

Change getheaders messages so that we wait up to 2 minutes for a response to a
prior getheaders message before issuing a new one.

Also change the handling of the getheaders message sent in response to a block
INV, so that we no longer use the hashstop variable (including the hash stop
will just mean that if our peer's headers chain is longer, then we won't learn
it, so there's no benefit to using hashstop).

Also, now respond to a getheaders during IBD with an empty headers message
(rather than nothing) -- this better conforms to the intent of the new logic
that it's better to not ignore a peer's getheaders message, even if you have
nothing to give. This also avoids a lot of functional tests breaking.

This concludes backport of core#25454 and core#25557
https://github.com/bitcoin/bitcoin/pull/25454/commits/abf5d16c24cb08b0451bdbd4d1de63a12930e8f5
https://github.com/bitcoin/bitcoin/pull/25454/commits/99f4785cad94657dcf349d00fdd6f1d44cac9bb0
https://github.com/bitcoin/bitcoin/pull/25557/commits/e939cf2b7645c2b20a68cb6129f3aebfdf287d61

Depends on D14912

Test Plan

ninja all check-all