Skip to content

fix: announce tip to new peers when synced#490

Draft
xdustinface wants to merge 4 commits intov0.42-devfrom
fix/announce-tip-to-new-peers
Draft

fix: announce tip to new peers when synced#490
xdustinface wants to merge 4 commits intov0.42-devfrom
fix/announce-tip-to-new-peers

Conversation

@xdustinface
Copy link
Collaborator

When already synced, send a GetHeaders with our tip locator to each
newly connected peer. Without this, Dash Core never learns our best-known
header and falls back to inv announcements instead of pushing unsolicited
header messages.

Based on:

When synced, `handle_headers_pipeline` always calls
`send_pending()` after receiving each new block header, triggering a
follow-up `GetHeaders` that always returned empty. This causes lot of
unnecessary round-trips and leaves the tip segment in a pending state
that rejected the next actual header as "unrequested headers".

Use `tip_was_complete` to distinguish unsolicited headers from active
catch-up responses. Only skip `send_pending()` and mark the tip complete
for the unsolicited case, so multi-batch catch-up still works correctly.
Deduplicate `GetHeaders` → `GetHeaders2` upgrade logic from `send_to_single_peer`
and `send_distributed` into a shared `send_message_to_peer` method.
Add `SendMessageToPeer` variant to `NetworkRequest` and
`request_block_headers_from_peer` to `RequestSender` so sync managers
can request block headers from specific peers.
When already synced, send a `GetHeaders` with our tip locator to each
newly connected peer. Without this, Dash Core never learns our best-known
header and falls back to inv announcements instead of pushing unsolicited
header messages.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/announce-tip-to-new-peers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict The PR conflicts with the target branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant