Repository navigation
fix(wallet): correct foreign prevout handling - #423
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #423 +/- ##
==========================================
+ Coverage 81.66% 81.83% +0.16%
==========================================
Files 25 25
Lines 6339 6281 -58
Branches 302 300 -2
==========================================
- Hits 5177 5140 -37
+ Misses 1055 1037 -18
+ Partials 107 104 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ced965e to
1b1d959
Compare
|
@noahjoeris is this ready for review? If so please update its status. It probably needs a rebase too. Thanks! |
|
Thanks for the ping. I forgot about this one, it needs some updates. It contains breaking changes to |
1b1d959 to
5542496
Compare
|
tAck 5542496 |
5542496 to
d3447f6
Compare
There was a problem hiding this comment.
ACK d3447f6
Ran test and reviewed code and confirmed code fixes issues so this should be ready to merge.
|
Can/should this one also be backported 3.x? |
|
LLM reviewer also suggested some additional tests and docs, but these can go in a separate PR:
|
32dd8d8 test(wallet): sign mixed taproot and non-taproot inputs (Noah Joeris) d01c07d fix(wallet): sign mixed taproot and non-taproot inputs (Noah Joeris) Pull request description: ### Description Fix a 3.2.0 regression where mixed Taproot/non-Taproot transactions fail signing with `MissingNonWitnessUtxo`. Verify Taproot amounts against parent transactions already stored in the wallet. Skip verification only when all inputs are verified Taproot without `ANYONECANPAY`. Thanks @nymius for prompting a closer look #423 (comment). ### Changelog notice ``` Fix signing of mixed Taproot/non-Taproot transactions. ``` ### Before submitting - [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk_wallet/blob/master/CONTRIBUTING.md) ACKs for top commit: Musab1258: tACK 32dd8d8 fametrano: tACK 32dd8d8 notmandatory: ACK 32dd8d8 Tree-SHA512: 75d1fcfd50bc5a8d53deef87eda545e0c0a32a4ac96bd6fbfb6e43e7133388e2f5a26d91ac1dab1541cad140278f0efdb49d6f47f16d9f8217efce68f90e9242
) 9dfc8b4 test(wallet): check foreign prevout handling (Noah Joeris) d3df249 fix(wallet): correct foreign prevout handling (Noah Joeris) Pull request description: ### Description Backport of #423 to `release/3.x`. Cherry-picked from master: 5a69e46, d3447f6. Fixes #345, fixes #556. ### Changelog notice ``` - Fixed `build_fee_bump` panic on a legacy foreign input with no parent tx; it now returns `BuildFeeBumpError::TransactionNotFound`. - `add_foreign_utxo` now overwrites `witness_utxo` with the prevout from `non_witness_utxo`. - Signing now fails with `InvalidNonWitnessUtxo` when `witness_utxo` and `non_witness_utxo` disagree. ``` ### Before submitting - [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk_wallet/blob/master/CONTRIBUTING.md) ACKs for top commit: thunderbiscuit: ACK 9dfc8b4. This is a clean backport. Tree-SHA512: 44c8d3e4d4ce35bf09e649bd67ced540a7d1c60b487f94d31211d1ce67599878f71cf09aca97f9f578740f7cb82c0c817dc23591bb920d64485db083b691f975
Closes #345
Closes #556
Description
Fee bumping a transaction with a foreign input needs that prevout in the wallet.
insert_txoutis enough for a taproot prevout, or any witness prevout whenonly_witness_utxois set. Legacy inputs, and other segwit inputs, need the full parent viaapply_update.calculate_fee,calculate_fee_rate,build_fee_bump, andadd_foreign_utxonow say so.This follows option 2 in #345: document the foreign-prevout workflow rather than make
add_foreign_utxofail for unregistered inputs.If a legacy foreign parent is missing,
build_fee_bumpused to build an input with neither UTXO field set andfinishpanicked. It now returnsTransactionNotFound.Notes to the reviewers
AddForeignUtxoErrorvariant would be a breaking change. We are avoiding one becauseTxBuilderis planned for removal in the next major release (roadmap). This PR cannot fail early the way my previous solution did. It documents the workflow and adds checks where the existing errors allow it.Wallet::insert_txis not introduced as my previous solution did. It was removed on purpose in fix(wallet)!: Improve test utilities bdk#1658, andapply_updateis how a full parent is registered. So this API surface is not necessary.Changelog notice
Fixed a panic when fee-bumping a legacy foreign input whose parent transaction is not in the wallet.
build_fee_bumpnow returnsBuildFeeBumpError::TransactionNotFound.Before submitting