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

wallet: avoid call bumpfeediscount with negative values

Public commit record

What the developer wrote

Authored by Pol Espinasa

85/100 · Strong
wallet: avoid call bumpfeediscount with negative values

ChooseSelectionResult computes the bump-fee discount as: summed_bump_fees - combined_bump_fee
Where summed_bump_fees is the sum of per-UTXO ancestor bump fees and combined_bump_fee is the
true combined cost taking into account shared ancestors.

Both variables use creates a fresh MiniMiner snapshot of the mempool. Because of that
the two snapshots of the mempool might be different. An artificial feerate decrease
of an ancestor using prioritizesettransaction can make combined_bump_fee > summed_bump_fees.
This cause calling bumpfeediscount with a negative vaule triggering an assertion >= 0.

This commit fixes this by only calling bumpfeediscount when the discount is strictly positive.

Co-authored-by: dergoegge <n.goeggi@gmail.com>
✓ Specific, 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 fixes a crash bug in Bitcoin Core's wallet coin selection. When the wallet tried to estimate fees for spending unconfirmed coins, it took two separate snapshots of the mempool. If the mempool changed between those snapshots—such as when someone artificially lowered a transaction's fee priority—the second fee could be higher than the first. That produced a negative 'discount' value, which then triggered an internal assertion that the value must be zero or positive, causing the wallet process to crash. The fix simply skips applying the discount when it would be negative.

Recommended action

Apply the patch. It is a minimal, correct change. Consider whether SetBumpFeeDiscount should also defensively reject negative inputs, but the primary fix is sufficient to prevent the crash described.

Security signals we found

01

Assertion failure from negative value passed to fee-discount helper

02

Race between two mempool snapshots used in the same coin-selection calculation

03

prioritisetransaction can flip the sign of the computed discount

04

Wallet-local denial of service via crafted mempool state

Risk score

Why this scored 57/100

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