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

validation: Don't add pruned blocks to m_blocks_unlinked on startup

Public commit record

What the developer wrote

Authored by marcofleon

81/100 · Strong
validation: Don't add pruned blocks to m_blocks_unlinked on startup

LoadBlockIndex() adds to m_blocks_unlinked based only on nTx > 0, without
checking BLOCK_HAVE_DATA. Pruning preserves nTx but clears BLOCK_HAVE_DATA,
so a pruned block whose parent was header-only gets re-added on every
restart, causing the CheckBlockIndex() assertion that entries must have
data on disk to fail.

Check that BLOCK_HAVE_DATA is set before inserting into m_blocks_unlinked.

Fixes #35050.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a bug where Bitcoin Core could crash on startup with a failed internal consistency check. The crash happened when a node had 'pruned' old block data while also having some header-only blocks, causing the program to incorrectly re-add pruned blocks to an internal list that is supposed to contain only blocks still stored on disk. The fix adds a check to skip pruned blocks when rebuilding that list during startup.

Recommended action

Apply the patch. It is a minimal, targeted fix. Nodes that prune and have header-only parent blocks in their block index are at risk of failing to start; upgrading or backporting is advisable. No immediate remote exploitation vector is evident, but the local crash-on-startup condition is disruptive.

Security signals we found

01

Assertion failure / denial of service at startup

02

Inconsistent internal block index state

03

Pruning interaction with header-only parent blocks

04

Fixes reported issue #35050

Risk score

Why this scored 53/100

Our methodology →
Potential impact 18/30
Exploitability 5/25
Stealth signal 8/15
Affected reach 10/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.