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

index: Fix coinstatsindex overflow issue

Public commit record

What the developer wrote

Authored by Fabian Jahr

73/100 · Adequate
index: Fix coinstatsindex overflow issue

The index originally stored cumulative values in a CAmount type but this allowed for
potential overflow issues which were observed on Signet. Fix this by
storing the values that are in danger of overflowing in a arith_uint256.

Also turns an unnecessary copy into a reference in RevertBlock and
CustomAppend and gets
rid of the explicit total unspendable tracking which can be calculated
by adding the four categories of unspendables together.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes an integer overflow bug in Bitcoin Core's optional coin statistics index. The index keeps running totals of spent and created coins, and on long-running or high-activity networks these totals could exceed the range of the 64-bit 'CAmount' type, causing wrong statistics or node instability. The fix widens the at-risk totals to a 256-bit type and removes a redundant stored total that can be computed from other values. It also changes the index's database directory name so upgraded nodes do not reuse the old, buggy data, while leaving the old directory in place for users who might downgrade.

Recommended action

Nodes that use -coinstatsindex=1 should upgrade to the fixed version. After upgrading, the old indexes/coinstats directory can be removed once the user is sure they will not downgrade to v29 or earlier. Operators relying on gettxoutsetinfo RPC output should be aware that the on-disk index format and directory changed, and that the index will be rebuilt under the new path.

Security signals we found

01

Integer overflow in cumulative monetary totals (CAmount overflow observed on Signet)

02

Data-format change requiring a new database directory to avoid loading legacy overflowed state

03

Removal of redundant total_unspendable_amount accumulator to reduce consistency risk

04

RevertBlock integrity checks replaced with direct DB state restoration, lowering rollback error surface

Risk score

Why this scored 57/100

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