Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netsync, main: always download headers for blocks #240

Conversation

kcalvinalvin
Copy link
Contributor

We change the code to handle headers and request headers from peers for
new block messages. This allows utreexo nodes to use the same code for
syncing up during ibd for new blocks as well.

specified a peer

Both of the functions currently default to the syncPeer for fetching
blocks and utreexo headers but if we allow our peers to send over
headers instead of invs, then we may not have a syncPeer as we're no
longer in ibd.

To allow these functions to be re-used when our peer sends us block
headers, we allow the caller to pass in the desired peer to request the
additional data from.
On VerAck, we send MsgSendHeaders to notify the peer that we prefer
headers instead of invs for blocks.
Since we'll always use the individual requestedUtreexoHeaders per peer,
we never need to have a global map. The global map is only useful during
inv requests but since we'll be syncing off of headers instead, we don't
need to have this map at all.
We'll only be syncing off of headers so we can re-use the
fetchHeaderBlocks even when we're not in headers first mode.
@kcalvinalvin kcalvinalvin merged commit fbbb32b into utreexo:main Jan 17, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant