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

index: don't commit state in BaseIndex::Rewind

Public commit record

What the developer wrote

Authored by Martin Zumsande

80/100 · Strong
index: don't commit state in BaseIndex::Rewind

The committed state of an index should never
be ahead of the flushed chainstate. Otherwise, in the case
of an unclean shutdown, the blocks necessary to revert
from the prematurely committed state would not be
available, which would corrupt the coinstatsindex in particular.
Instead, the index state will be committed with the next
ChainStateFlushed notification.
✓ 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 a crash-and-restart bug in Bitcoin Core's index tracking. Previously, during a blockchain reorganization (a 'reorg'), an index could save its new position to disk before the main chain data was fully flushed. If the computer then shut down uncleanly, the index could point to blocks that had already been pruned away, leaving the index corrupted on restart. The fix removes that premature save so the index only commits its position when the main chain state is safely flushed.

Recommended action

Apply the patch. Nodes running indexes (especially coinstatsindex) should upgrade to avoid potential index corruption after reorgs and unclean shutdowns. If an affected node fails to start after an unclean shutdown, reindexing may be required.

Security signals we found

01

Data-integrity / corruption bug in index persistence during reorg

02

Premature commit of index state relative to chainstate flush

03

Potential unclean-shutdown-induced index corruption, specifically coinstatsindex

04

Fix removes unsafe Commit() call and reverts failure-handling rollback logic

Risk score

Why this scored 64/100

Our methodology →
Potential impact 22/30
Exploitability 8/25
Stealth signal 12/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.