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

wallet: fix amount computed as boolean in coin selection

Public commit record

What the developer wrote

Authored by furszy

73/100 · Adequate
wallet: fix amount computed as boolean in coin selection

The comparison is evaluated before the assignment, so total_amount
ends up holding a boolean instead of the actual amount:
total_amount = (a - b < c)
which is not what we want here. This has been working by accident.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

A single missing semicolon in Bitcoin Core's wallet coin-selection code caused a comparison to run before an assignment. As a result, the variable that was supposed to hold the total available amount instead held just true or false. The code still mostly worked by accident, but the wrong value could mislead the wallet's decision about whether it has enough funds, especially when unconfirmed transactions with long chains are involved. This could lead to confusing error messages or, in edge cases, incorrect transaction creation.

Recommended action

Apply the patch. After patching, review whether the buggy code path could have produced incorrect SelectionResult or fee/change calculations in edge cases involving long unconfirmed chains, and consider adding regression tests for this branch.

Security signals we found

01

Operator precedence bug causing unintended boolean assignment

02

Downstream arithmetic on a variable that held a boolean value

03

Coin-selection logic affecting fund availability checks

04

Potential incorrect handling of long unconfirmed transaction chains

Risk score

Why this scored 46/100

Our methodology →
Potential impact 12/30
Exploitability 5/25
Stealth signal 8/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.