Push genesis block to new peers after handshake to help late joiners #227
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.
Summary
Fixes genesis block propagation issue where late-joining nodes never receive the genesis block. Previously, the genesis block was only broadcast once when created, but if only 1-2 peers were connected at that time, other nodes would never receive it.
This change adds a mechanism to broadcast the genesis block whenever a new peer completes handshake, helping late joiners receive the genesis block. Includes rate limiting (30s per peer address) to reduce redundant broadcasts.
Key changes:
push_genesis_to_peer()function that broadcasts genesis block after handshake completionhandle_handshake_message()after successful handshakeReview & Testing Checklist for Human
mxd_broadcast_block), not just the newly connected peer. This means every new peer connection triggers a network-wide genesis broadcast (subject to rate limiting).Recommended test plan:
./letsgo testnet -reseton all 10 test nodesNotes
Link to Devin run: https://app.devin.ai/sessions/f0a6357d898e440ea3745d77dfb91d8d
Requested by: Runo (runonetworks@gmail.com) / @AlanRuno
This is part of ongoing work to fix genesis block propagation. Previous fixes (PR #226) addressed DHT peer port issues but genesis still wasn't reaching all nodes because the initial broadcast happened too early.