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

kernel: acquire coinstats cursor and block info atomically

Public commit record

What the developer wrote

Authored by w0xlt

73/100 · Adequate
kernel: acquire coinstats cursor and block info atomically

Acquire the cursor and block index under the same cs_main lock to
eliminate a potential race where a new block could be connected
between capturing the block info and acquiring the cursor, causing
the reported stats to reference a different block than the one
being iterated.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This change fixes a timing bug in how Bitcoin Core calculates statistics about all unspent coins (the UTXO set). Previously, the code could read the current best block, then briefly allow a new block to be connected, and only then start scanning the coin database. That could make the final report say it was for block X while the actual data came from block X+1. The fix captures both the block pointer and the database cursor while holding the same global lock, so they stay consistent. It is a correctness fix for an RPC/administrative feature, not a direct theft or remote-code-execution vulnerability.

Recommended action

Backport to maintained release branches if coinstats consistency is relied upon; otherwise treat as routine correctness fix. No emergency deployment required.

Security signals we found

01

Race condition between block index lookup and UTXO cursor acquisition

02

Inconsistent coin statistics report (block metadata vs. UTXO snapshot)

03

Use of global cs_main lock to atomicize multi-step state reads

04

Correctness fix for gettxoutset RPC / coinstats index data

Risk score

Why this scored 26/100

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