]> Untitled Git - bdk/commit
fix(bdk): Remove extra taproot fields when finalizing Psbt
authorvmammal <valuedmammal@protonmail.com>
Wed, 31 Jan 2024 21:18:09 +0000 (16:18 -0500)
committervmammal <valuedmammal@protonmail.com>
Wed, 28 Feb 2024 22:24:09 +0000 (17:24 -0500)
commit5840ce473e430de4c4e3698734e9667cc476fee4
tree2e768604d6de44f8950a876ecb6ff14a40f2f711
parent8c78a42163dee06b640f46d74255df37dbc53873
fix(bdk): Remove extra taproot fields when finalizing Psbt

We currently allow removing `partial_sigs` from a finalized Psbt,
which is relevant to non-taproot inputs, however taproot related Psbt
fields were left in place despite the recommendation of BIP371 to remove
them once the `final_script_witness` is constructed. This can cause
confusion for parsers that encounter extra taproot metadata in an
already satisfied input.

Fix this by introducing a new member to SignOptions
`remove_taproot_extras`, which when true will remove extra taproot
related data from a Psbt upon successful finalization. This change
makes removal of all taproot extras the default but configurable.

test(wallet): Add test
`test_taproot_remove_tapfields_after_finalize_sign_option`
that checks various fields have been cleared for taproot
Psbt `Input`s and `Output`s according to BIP371.
crates/bdk/src/wallet/mod.rs
crates/bdk/src/wallet/signer.rs
crates/bdk/tests/wallet.rs