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

coins: don't mutate main cache when connecting block

Public commit record

What the developer wrote

Authored by Andrew Toth

83/100 · Strong
coins: don't mutate main cache when connecting block

Use `CoinsViewOverlay` when connecting blocks in `ConnectTip`.

Add a new integration test to verify that using
CoinsViewOverlay does not mutate the main cache
during validation for an invalid block.

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

What changed, and why it matters

This Bitcoin Core change fixes how the coin cache behaves when a new block fails validation. Previously, the same cache used for the main chain was temporarily used during block validation, which could leave behind entries from invalid blocks. Now a separate overlay view is used, so failed blocks don't pollute the main cache. The commit adds a test proving that an invalid block no longer leaves its inputs in the cache. This is a correctness and denial-of-service hardening fix rather than a direct theft bug.

Recommended action

Treat as a routine but worthwhile hardening patch. Reviewers should verify that CoinsViewOverlay correctly discards all changes on destruction/reset and that the overlay flush-on-success path is the only path that can modify m_cacheview. No emergency action is indicated by the diff alone.

Security signals we found

01

Denial-of-service hardening: invalid blocks could previously pollute the in-memory coin cache, potentially affecting subsequent validation behavior or cache eviction

02

Correctness fix: separation of validation scratch state from committed chain state

03

New regression test specifically checks that a rejected block does not cache its inputs

Risk score

Why this scored 61/100

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