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

p2p: During block download, adjust pindexLastCommonBlock better

Public commit record

What the developer wrote

Authored by Martin Zumsande

85/100 · Strong
p2p: During block download, adjust pindexLastCommonBlock better

Simplify and improve the logic for calculating pindexLastCommonBlock, in order to calculate
nWindowEnd better.
The previous logic would not take into account when the chain tip had moved forward, so that
FindNextBlocks could iterate over many blocks already downloaded and
connected, which could result in blocks not being requested for download that should have been
requested, and peers being wrongly marked as staller.

It also removes extra logic from commit 49d569cb1fdd62a9da8dff51dccaf4680fe3d0eb
for the situation right after a snapshot was loaded:
After snapshot loading, our tip becomes the snapshot block.
For peers that have the most-work chain, which inlcludes the snapshot,
our tip is an ancestor of the peer's best block, hence the general
advancement logic will move pindexLastCommonBlock
from any pre-snapshot position to the snapshot height automatically.

Co-authored-by: stringintech <stringintech@gmail.com>
Co-authored-by: Pieter Wuille <pieter@wuille.net>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This change fixes how Bitcoin nodes decide which blocks to ask peers for during initial sync or catch-up. Previously, the node could get stuck reviewing blocks it already had, fail to request new blocks it actually needed, and incorrectly label peers as slow (stallers). The patch makes the 'last common block' calculation follow the current chain tip and the peer's known chain more accurately. It is a robustness improvement to block download scheduling, not a direct theft or remote-code-execution bug.

Recommended action

Treat as a normal bug-fix merge. Nodes should upgrade in due course, especially if they rely on fast sync or operate with many peers. No emergency response is indicated by the diff alone. Monitor release notes for any additional context on stalling scenarios.

Security signals we found

01

Denial-of-service vector: incorrect staller marking could slow or stall block download for a node

02

Logic bug in P2P block download scheduling

03

No input validation bypass, memory corruption, or cryptographic weakness visible in diff

04

Patch is small and targeted (1 file, ~9 lines changed)

Risk score

Why this scored 36/100

Our methodology →
Potential impact 8/30
Exploitability 3/25
Stealth signal 6/15
Affected reach 10/15
Confidence 6/10
Evidence quality 3/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.