Skip to content

Sign wallet inputs of transactions inserted by wallet tests - #1255

Open
jkczyz wants to merge 1 commit into
lightningdevkit:mainfrom
jkczyz:2026-11-bdk-wallet-3.2.1-test-signing
Open

jkczyz wants to merge 1 commit into
lightningdevkit:mainfrom
jkczyz:2026-11-bdk-wallet-3.2.1-test-signing

Conversation

@jkczyz

@jkczyz jkczyz commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

bdk_wallet 3.2.1 (released 2026-11-23) verifies the signatures of an unconfirmed transaction's inputs that spend the wallet's own outputs. When they fail, Wallet::apply_update and Wallet::apply_unconfirmed_txs drop the transaction and Wallet::build_fee_bump refuses it. We ask for bdk_wallet = "3.2.0" and don't commit a lock file, so every fresh CI run now builds against 3.2.1.

Several wallet tests insert spends of wallet coins with empty witnesses, which the wallet no longer takes in. On main with 3.2.1:

  • Nine lib tests fail:
    • a_sync_evicting_a_pending_send_returns_it_to_the_wallet
    • an_evicted_fee_bump_returns_over_the_transaction_it_replaced
    • an_evicted_send_does_not_return_over_other_transactions
    • an_on_chain_fee_bump_passes_a_transaction_that_funds_no_channel
    • an_on_chain_fee_bump_refuses_a_transaction_whose_facts_cannot_be_read
    • an_on_chain_fee_bump_refuses_while_the_channel_state_cannot_be_consulted
    • bump_fee_rbf_keeps_replaced_txid_mapped
    • confirmed_unlocked_amount_does_not_depend_on_seeing_a_splice
    • evicted_sends_return_along_with_the_sends_they_spend
  • Four more keep passing without the transaction they are about:
    • Three expect a fee bump to be refused with InvalidPaymentId, which is also what a transaction missing from the wallet yields:
      • an_on_chain_fee_bump_refuses_a_transaction_a_channel_reported
      • an_on_chain_fee_bump_refuses_a_transaction_spending_a_coin_the_wallet_does_not_own
      • an_on_chain_fee_bump_refuses_a_transaction_whose_output_belongs_to_a_channel
    • an_evicted_fee_bump_does_not_return_over_a_confirmed_transaction expects the bump to stay out of the wallet, where it never was.

This PR signs those inputs in the test helpers. The helpers also assert that the wallet took the transaction in, so that a transaction dropped again fails the test that inserts it.

Production code

Only tests change. The wallet's descriptors are BIP84, so every input it owns is P2WPKH, and its signature verifies from that input's own previous output. The case the release notes warn about (a taproot input next to foreign inputs, for which Electrum users should sync with fetch_prev_txouts = true) does not arise, and our Electrum sync already passes true. Transactions a chain source relays are signed, and the ones the node inserts itself are signed first.

Testing

  • cargo test --lib with 3.2.1 in the lock file: 478 passed, 9 failed on main; 487 passed with this PR.
  • cargo test --lib with 3.2.0: 487 passed with this PR.
  • Turn the pending payment store into an OnchainPaymentTracker #1240 adds a_late_funding_classification_tracks_the_channels, which fails on 3.2.1 for the same reason. With this commit on top of its head 3d522b8b, all 495 lib tests pass.

🤖 Generated with Claude Code

bdk_wallet 3.2.1 verifies the signatures of an unconfirmed
transaction's inputs that spend the wallet's own outputs. When they
fail it drops the transaction on sync and refuses to fee-bump it. Our
manifest admits 3.2.1 and we don't commit a lock file, so CI builds
against it.

Several wallet tests inserted such transactions with empty witnesses,
which the wallet no longer took in. Nine tests failed. Four more kept
passing without the transaction they are about: three expect a fee
bump to be refused with the error an unknown transaction also yields,
and one expects an evicted fee bump to stay out of the wallet.

Sign those inputs in the test helpers, and have the helpers check that
the wallet took the transaction in, so that a transaction dropped
again fails the test that inserts it.

Only tests change. The wallet's outputs are all P2WPKH, whose
signatures verify without the previous outputs of a transaction's
other inputs, and the transactions a chain source relays are signed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@ldk-reviews-bot

ldk-reviews-bot commented Nov 23, 2026 •

Copy link
Copy Markdown

I've assigned @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

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.

3 participants