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

index: Don't commit ahead of the flushed chainstate

Public commit record

What the developer wrote

Authored by Martin Zumsande

85/100 · Strong
index: Don't commit ahead of the flushed chainstate

Otherwise, if the node has an unclean restart,
indexes with state (coinstatsindex) couldn't reorg to the
last flushed tip and would be corrupted.

Also updates documentation of Commit() -
the locator functionality isn't used, so the previous text was wrong:
We must have the best block in our block index after a restart.

Co-authored-by: Fabian Jahr <fjahr@protonmail.com>
✓ 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 commit fixes a corruption risk in Bitcoin Core's optional indexes (notably coinstatsindex). Previously, an index could save its progress to disk even though the main chainstate database had not yet flushed that far. If the node then crashed and restarted, the index would be ahead of data it needed to roll back to during a reorganization, leaving the index corrupted. The fix makes the index skip saving until the chainstate has flushed at least as far as the index tip. It also corrects outdated documentation and updates a test to match the new behavior.

Recommended action

Treat as a reliability/corruption hardening patch. Users running coinstatsindex or other stateful indexes should upgrade to avoid potential index corruption after power loss or unclean shutdown. No immediate remote-exploitable vulnerability is indicated.

Security signals we found

01

Data corruption on unclean shutdown/reorg

02

Index state inconsistency with chainstate

03

coinstatsindex specifically mentioned as affected

04

Safety check added to disk commit path

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.