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

fuzz: make `AddCoins` query view for overwrites

Public commit record

What the developer wrote

Authored by Lőrinc

90/100 · Strong
fuzz: make `AddCoins` query view for overwrites

In validation, `AddCoins(check_for_overwrite=false)` is only used after BIP30 has already ensured the transaction does not overwrite any unspent outputs in the UTXO view.
The coins view fuzz target can call `AddCoins` with arbitrary txids, so using the `check_for_overwrite=false` fast path on non-coinbase transactions may violate the `AddCoin` caller contract and trigger logic errors.
Only use `check_for_overwrite=false` when we have first confirmed that none of the outputs are currently unspent.
Otherwise, fall back to `check_for_overwrite=true` so `AddCoins` determines overwrites via the view.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification
The short version

What changed, and why it matters

This is a fix inside a Bitcoin Core fuzz test, not in the live network code. The fuzz test randomly feeds data into coin-handling functions to find crashes. Previously, the test could call AddCoins in a way that breaks an internal rule (overwriting an unspent coin while telling the function not to check for overwrites), causing assertion failures or logic errors. The patch makes the fuzz test check the coin view first, so it only uses the fast 'no overwrite check' path when it is actually safe. It does not change how real Bitcoin nodes validate transactions.

Recommended action

No urgent action for node operators. This is a test-only improvement. Developers should ensure fuzz targets continue to cover both AddCoins code paths and that the new PeekCoin loop does not materially slow fuzzing. Consider whether the same precondition should be documented more explicitly in AddCoins/AddCoin callers.

Security signals we found

01

Fix is in a fuzz test harness, not production code

02

Removes expected logic_error/exception path from test

03

Adds view query (PeekCoin) before AddCoins to satisfy caller precondition

04

Caller-contract violation could previously trigger assertion or std::logic_error

05

No change to consensus validation, BIP30, or AddCoins implementation

Risk score

Why this scored 17/100

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