Skip to content

wallet: load-time bounds and fee rescue selection (v26.06.7 security, 6/7) - #9512

Merged
nGoline merged 4 commits into
ElementsProject:masterfrom
nGoline:port-26.06.7-wallet
Sep 15, 2026
Merged

nGoline merged 4 commits into
ElementsProject:masterfrom
nGoline:port-26.06.7-wallet

Conversation

@nGoline

@nGoline nGoline commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Sixth of seven PRs forward-porting the v26.06.7 security point release onto master.

Bounds checking on what the database hands back at load, and input selection for fee rescue.

4 commits:

  • tests: cover fee rescue input selection with an immature coinbase
  • wallet: exclude immature coinbase outputs from fee rescue selection
  • wallet: bound-check shachain_known pos on load
  • db: tidy db_col_psbt NULL handling

Two Changelog-Fixed: an out-of-range shachain index in the database is rejected at load instead of read out of bounds, and anchor and HTLC fee rescue no longer select immature coinbase outputs, which produced a transaction bitcoind rejects.

For reviewers

The first two commits are a test-then-fix pair: the test lands marked xfail(strict=True) and the next commit removes the marker.

Applies cleanly to master with no conflicts, and every commit is byte-identical to its release-line original.

nGoline and others added 4 commits September 15, 2026 18:31
wallet_utxo_boost() picks the wallet inputs which fund anchor and HTLC fee
rescue transactions. Ordinary coin selection filters immature coinbase
outputs via deep_enough(); a rescue funded by one cannot confirm, so rescue
selection needs the same filter.

Give the closing node a single immature block reward as its only wallet
output, and check that it declines to boost rather than selecting it.

Marked xfail(strict=True) since the selector is not yet fixed; the next
commit removes the marker.

(cherry picked from commit daa5654)
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 5e79baa)
Keep the loaded pos within the known[] array like the other defensive
checks in the channel loader, so a malformed row fails loudly instead of
indexing out of range.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Changelog-Fixed: wallet: an out-of-range shachain index in the database is now rejected at load instead of read out of bounds.
(cherry picked from commit fdd7b11)
Return early for a NULL column like the sibling db_col_* helpers, and
only parse and set the version when there is actual data to work with.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Changelog-None

(cherry picked from commit d6f8cc3)
@nGoline
nGoline force-pushed the port-26.06.7-wallet branch from 42180ea to 22fa10f Compare September 15, 2026 21:34
@nGoline
nGoline merged commit f8ca3f4 into ElementsProject:master Sep 15, 2026
1 of 2 checks passed
@nGoline
nGoline deleted the port-26.06.7-wallet branch September 15, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant