AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 33 Bitcoin

Merge bitcoin/bitcoin#34743: p2p: don't disconnect manual peers for block stalling

Public commit record

What the developer wrote

Authored by merge-script

91/100 · Strong
Merge bitcoin/bitcoin#34743: p2p: don't disconnect manual peers for block stalling

5551d39b202bf0386fb40589817cd92f8afdaf59 doc: document manual peer stalling behavior (will)
24628d3ae7dce6f2188065a63567db3d030de3bb test: cover manual peer block download cooldown (will)
4c79f3a34d003bd97824b032383ac816a4147d68 test: support manual connections in addconnection (will)
698b5bbf3a0a0a52d97ae6acce2752769f14a208 p2p: pause stalling manual block downloads (will)

Pull request description:

Ref: #5097

Manual peers added via `-addnode`, `-connect`, or the `addnode` RPC represent explicit operator intent to keep those connections around.

During IBD, a manual peer can currently be disconnected if it triggers block-stalling logic. This can be surprising in `-connect` or `-addnode`-based setups, where the operator may prefer (and probably expect) to keep the peer connected even if it is not a useful block download peer at that moment.

This PR changes only the block-stalling path. Instead of disconnecting a stalling manual peer, it releases that peer's in-flight block requests so other peers can request them and IBD can continue.

After releasing the requests, the manual peer is temporarily skipped for block downloads. This avoids immediately assigning scarce IBD block download slots back to the peer that just stalled, while still allowing the peer to become eligible again after the cooldown.

This intentionally does not change block download timeout or headers sync timeout behavior.

ACKs for top commit:
sedited:
Re-ACK 5551d39b202bf0386fb40589817cd92f8afdaf59

Tree-SHA512: 0fb914c56df14ccd38b0edd1269ea705968dad4e9d732004538408fe7c06f3afb29aad65e83c7503b8c66dc45c123d2367d286c04ad6a22a2d17052d4ba759cd
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This change makes Bitcoin Core treat manually-added peers (from -addnode, -connect, or the addnode RPC) more gently during Initial Block Download (IBD). Previously, if such a peer was slow or stalled at sending blocks, the node would disconnect it. Now it releases the pending block requests to other peers so IBD can continue, pauses asking that peer for blocks for two minutes, and keeps the connection open. This matches operator intent that manual peers should stay connected, but it is a behavior change, not a fix for an exploitable vulnerability.

Recommended action

Review the change for operational correctness and resource exhaustion edge cases, such as many manual peers stalling simultaneously and consuming in-flight block slots or cooldown state. No urgent security patch is indicated. Operators using -addnode/-connect should be aware that a stalling manual peer will now remain connected but be skipped for block downloads for two minutes.

Security signals we found

01

Behavior change in peer disconnection logic during IBD

02

Manual peers exempted from block-stalling disconnection

03

New per-peer cooldown state m_block_download_paused_until introduced

04

In-flight block requests released to prevent IBD stalling

05

Test-only RPC AddConnection now supports ConnectionType::MANUAL

Risk score

Why this scored 33/100

Our methodology →
Potential impact 8/30
Exploitability 3/25
Stealth signal 4/15
Affected reach 6/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.