netsync: Mark blocks as known via headers.#3704
Merged
Merged
Conversation
jholdstock
approved these changes
Jun 14, 2026
dajohi
approved these changes
Jun 23, 2026
Currently, the known blocks for each peer are only updated when receiving and sending inv announcements for blocks and when receiving the blocks themselves. That historically covered all relevant cases since syncing was purely done via getblocks and the resulting inv announcements. However, block announcements are now done via header announcements instead and that path does not currently add the associated block as known inventory when it sees the header. This ultimately leads to some unnecessary extra work that gets thrown away. This resolves that issue by updating the logic that processes announced headers to add the associated block to the known inventory accordingly.
255dc9e to
13092c3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the known blocks for each peer are only updated when receiving and sending
invannouncements for blocks and when receiving the blocks themselves. That historically covered all relevant cases since syncing was purely done viagetblocksand the resultinginvannouncements.However, block announcements are now done via header announcements instead and that path does not currently add the associated block as known inventory when it sees the header. This ultimately leads to some unnecessary extra work that gets thrown away.
This resolves that issue by updating the logic that processes announced headers to add the associated block to the known inventory accordingly.