Skip to content

[Fix] Create a better log message when not connected to any peers.#3947

Merged
vicsn merged 3 commits intostagingfrom
fix/sync-log-nopeers
Oct 17, 2025
Merged

[Fix] Create a better log message when not connected to any peers.#3947
vicsn merged 3 commits intostagingfrom
fix/sync-log-nopeers

Conversation

@kaimast
Copy link
Copy Markdown
Contributor

@kaimast kaimast commented Oct 16, 2025

This is a simpler attempt at fixing #3885. The PR does not fix the issue of nodes starting as synced, but I will leave that for another PR.

The core change is that the sync state is never changed during block request generation, but only when processing responses, new block locators, or disconnects. For disconnects, there is a new function SyncStatus::clear_greatest_peer_height that is used when a peer disconnects and no block locators are remaining.
When invoking that function, the node's sync state will switch to unsynced until it receives new block locators.

The PR also adds more documentation to this delicate part of the codebase. Hopefully, the comments make the changes easy to review.

@kaimast kaimast force-pushed the fix/sync-log-nopeers branch from 0d3af1c to dfe67fb Compare October 16, 2025 22:49
@kaimast kaimast force-pushed the fix/sync-log-nopeers branch from dfe67fb to c8cb8a6 Compare October 16, 2025 22:52
Comment thread node/sync/src/block_sync.rs
@kaimast kaimast marked this pull request as ready for review October 17, 2025 01:27
Copy link
Copy Markdown
Collaborator

@vicsn vicsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vicsn vicsn merged commit d342b5f into staging Oct 17, 2025
5 checks passed
@vicsn vicsn deleted the fix/sync-log-nopeers branch October 17, 2025 11:05
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.

2 participants