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

coins: make `CCoinsView` methods pure virtual

Public commit record

What the developer wrote

Authored by Lőrinc

80/100 · Strong
coins: make `CCoinsView` methods pure virtual

`CCoinsView` provided default no-op implementations, which allowed constructing a bare view and silently getting dummy behavior.
Make all interface methods pure virtual and remove the legacy default definitions from `coins.cpp` so callers must choose an explicit implementation.
Move the virtual destructor to the beginning to avoid mixing it between the methods.
No-op backing behavior remains available via `CoinsViewEmpty`.
✓ 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 tightens up a key internal interface in Bitcoin Core so that developers can no longer accidentally create a 'dummy' version of the coin database view that silently does nothing. It is a defensive code-quality change, not a fix for an active security bug. The change makes the interface 'pure virtual,' meaning every real implementation must explicitly define all required behavior, and moves the no-op behavior into a clearly named 'CoinsViewEmpty' helper. It also adds a missing explicit implementation for one database-backed view (PeekCoin in CCoinsViewDB).

Recommended action

No urgent action required. Treat as normal code-hardening/maintenance. Review downstream subclasses to ensure all pure virtual methods are implemented; the patch already updates CCoinsViewDB. If backporting, verify that any project-specific subclasses of CCoinsView also implement the now-pure-virtual methods.

Security signals we found

01

Defensive hardening: interface methods made pure virtual to prevent accidental instantiation of a no-op view

02

Silent dummy behavior removed from base class and isolated into an explicitly named CoinsViewEmpty

03

Missing override added: CCoinsViewDB::PeekCoin now explicitly implemented

04

Comment clarification in CCoinsViewMemPool about base-view cache population

Risk score

Why this scored 18/100

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