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

validation: Don't use m_chain.Tip() in FlushStateToDisk

Public commit record

What the developer wrote

Authored by Martin Zumsande

73/100 · Adequate
validation: Don't use m_chain.Tip() in FlushStateToDisk

In DisconnectBlock(), we can call FlushStateToDisk after updating
the coins but before changing the tip, which is still at the
disconnected block. This means that the ChainStateFlushed
signal would have the wrong block in the locator.

Also remove an outdated comment - the wallet doesn't use
ChainStateFlushed anymore, currently only indexes do.

Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a minor bookkeeping bug in Bitcoin Core. When flushing state to disk during a block disconnection, the code was incorrectly reporting the current chain tip (the block being disconnected) as the flushed block, instead of the last block actually written to disk. This could mislead indexers or other listeners tracking the chain's flushed state, but it does not directly allow theft, double-spending, or consensus failure.

Recommended action

Treat as a routine correctness fix. Index operators and downstream services consuming ChainStateFlushed should ensure they handle reorg/disconnect edge cases gracefully. No emergency deployment is warranted solely for this change.

Security signals we found

01

Incorrect state reporting in a chain-state flush signal

02

Potential inconsistency between on-disk state and signaled locator during reorg/disconnect paths

03

Indexers relying on ChainStateFlushed could observe a stale or mismatched block locator

Risk score

Why this scored 28/100

Our methodology →
Potential impact 5/30
Exploitability 2/25
Stealth signal 4/15
Affected reach 6/15
Confidence 7/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.