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

wallet: exclude immature coinbase outputs from fee rescue selection

Public commit record

What the developer wrote

Authored by cdecker

73/100 · Adequate
wallet: exclude immature coinbase outputs from fee rescue selection

wallet_utxo_boost() selects wallet-funded inputs for anchor and HTLC fee
rescue transactions, but unlike ordinary coin selection it never applied
the coinbase-maturity check. An immature coinbase could therefore be the
sole rescue input, producing a consensus-invalid transaction that Bitcoin
Core rejects as a premature coinbase spend.

Apply the same utxo_is_immature() filter used by deep_enough()/ordinary
selection. Since both call sites pass the live blockheight and rebuild on
reorg/RBF, maturity is revalidated at construction and after reorgs.

This makes test_anchorspend_ignores_immature_coinbase pass, so its xfail
marker is dropped.

Changelog-Fixed: Wallet: anchor and HTLC fee rescue no longer select immature coinbase outputs, which produced a transaction bitcoind rejects
(cherry picked from commit 5e79baacc1c900c29acfae852f6233095872e309)
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This fix prevents Core Lightning from trying to use freshly created bitcoins (immature coinbase rewards) as emergency funds for fee-bump transactions. Such a transaction would be invalid under Bitcoin's rules and would be rejected by the network, potentially leaving a channel unable to quickly bump fees during congestion. The patch adds the same maturity check already used for normal spending.

Recommended action

Apply the patch. Ensure all coin-selection paths for fee-bump/rescue transactions share the same maturity/CSV checks. Consider adding a regression test for HTLC rescue specifically if not already covered.

Security signals we found

01

Consensus-invalid transaction generation prevented

02

Fee rescue / CPFP failure mode mitigated

03

Coinbase maturity check added to coin selection

04

Test xfail removed: test_anchorspend_ignores_immature_coinbase now passes

Risk score

Why this scored 60/100

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