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

Restore `Wallet` UTXO locks when coin selection fails afterwards

Public commit record

What the developer wrote

Authored by elnosh

73/100 · Adequate
Restore `Wallet` UTXO locks when coin selection fails afterwards

`Wallet` locks the UTXOs it selects before fetching the change script
and the previous transactions from the `WalletSource`. If either of
those fails, the selection is discarded but the UTXOs stay locked.
Record the previous lock entry of every UTXO a selection locks and put
it back if the selection fails afterwards.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug in the wallet's coin-selection code. When the wallet picked UTXOs to spend, it locked them immediately so they couldn't be reused. But if a later step—fetching the change address or the previous transaction—failed, the selection was thrown away while the UTXOs stayed locked. That could permanently or temporarily freeze funds that should have been spendable. The patch records each UTXO's prior lock state and restores it when the later step fails, and adds tests proving both newly locked and previously-locked UTXOs are handled correctly.

Recommended action

Review and merge the patch. After merge, verify that any long-running nodes that experienced `get_change_script` or `get_prevtx` failures have not accumulated stale UTXO locks; a restart or wallet resync may clear them depending on persistence design. No immediate incident response is required unless users report unexpectedly unspendable UTXOs.

Security signals we found

01

Resource lock leak on error path

02

UTXO lock state inconsistency between selection and confirmation

03

Denial-of-service/funds-unavailability risk from persistent UTXO locks

04

Defensive fix with regression tests

Risk score

Why this scored 49/100

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