-
Notifications
You must be signed in to change notification settings - Fork 313
Commit 87d0123
committed
Merge bitcoin/bitcoin#25454: p2p: Avoid multiple getheaders messages in flight to the same peer
99f4785 Replace GetTime() with NodeClock in MaybeSendGetHeaders() (Suhas Daftuar)
abf5d16 Don't send getheaders message when another request is outstanding (Suhas Daftuar)
ffe87db Cleanup received_new_header calculation to use WITH_LOCK (Suhas Daftuar)
6d95cd3 Move peer state updates from headers message into separate function (Suhas Daftuar)
2b341db Move headers direct fetch to end of ProcessHeadersMessage (Suhas Daftuar)
29c4518 Move headers-direct-fetch logic into own function (Suhas Daftuar)
bf8ea6d Move additional headers fetching to own function (Suhas Daftuar)
9492e93 Add helper function for checking header continuity (Suhas Daftuar)
7f24508 Move handling of unconnecting headers into own function (Suhas Daftuar)
Pull request description:
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 PR also reworks the headers processing logic to make it more readable.
ACKs for top commit:
ajtowns:
ACK 99f4785 ; code review, check over new logic of when to send getheaders messages
dergoegge:
Code review ACK 99f4785
mzumsande:
Code Review ACK 99f4785
sipa:
utACK 99f4785
w0xlt:
tACK bitcoin/bitcoin@99f4785 Good improvement in the code.
Tree-SHA512: b8a63f6f71ac83e292edc0200def7835ad8b06b2955dd34e3ea6fac85980fa6962efd31d689ef5ea121ff5477ec14aafa4bbe2d0db134c05f4a31a57a8ced365File tree
Expand file treeCollapse file tree
3 files changed
+292
-177
lines changedFilter options
- src
- test/functional
Expand file treeCollapse file tree
3 files changed
+292
-177
lines changed
0 commit comments