Skip to content

Refuse to start warp sync when too few peer slots are configured#12287

Open
dimartiro wants to merge 1 commit into
paritytech:masterfrom
dimartiro:fix/10222-warp-sync-peer-threshold
Open

Refuse to start warp sync when too few peer slots are configured#12287
dimartiro wants to merge 1 commit into
paritytech:masterfrom
dimartiro:fix/10222-warp-sync-peer-threshold

Conversation

@dimartiro

Copy link
Copy Markdown
Contributor

Description

Closes #10222.

Warp sync only begins once at least min_peers_to_start_warp_sync full-node peers (3 by default) are connected. However, a node could be started with --sync=warp and a peer-slot configuration that can never reach that threshold — e.g. --in-peers 0 --out-peers 0 — in which case it would silently get stuck forever, waiting for peers it has no room to accept:

⏩ Warping, Waiting for 3 peers to be connected, ... (0 peers)
sync: Too many full nodes, rejecting <peer>

Fix

At sync-engine startup (SyncingEngine::new, which already returns a Result), the node now fails fast with an actionable error when warp sync is requested but the configured peer slots can never reach the threshold, instead of hanging. The check accounts for reserved nodes, since they connect outside of the regular inbound/outbound slot limits and also count towards the warp sync threshold.

The validation lives in a small pure helper, ensure_warp_sync_can_start, so it is easy to unit-test in isolation.

@dimartiro dimartiro force-pushed the fix/10222-warp-sync-peer-threshold branch from f657f49 to a37ff50 Compare June 5, 2026 23: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.

sync: Cannot warp sync when --in-peers=0 --out-peers=0

1 participant