Description of the bug
I discovered that if you create a transaction with no recipient,
drain_wallet set to false, drain_to set with some scriptpubkey, left all
the other TxParams as they are and finish the psbt, you still make a
transaction paying the fees for the fixed parts of the transaction and the fees
generated through coin selection.
It doesn't seem to be intentional and it drains funds from your wallet for free
as result.
To Reproduce
I crafted a proof of concept.
Expected behavior
I expect that a psbt without recipients and not used to sweep a descriptor shouldn't be allowed to finalize.
Build environment
- BDK tag/commit: fbd98b4
- OS+version:
5.10.105-1-MANJARO
- Rust version:
rustc 1.58.1 (db9d1b20b 2022-01-20)
- Cargo version:
cargo 1.58.0 (f01b232bc 2022-01-19)
- Rust/Cargo target:
x86_64-unknown-linux-gnu
Additional context
I also attempted a fix in this commit
but there're conflicts with RBF policies.
It seems that bump_fee sets drain_wallet to false through the use of
Default values to create the new psbt with the bumped fee.
I'm not familiar enough with RBF to know what I can and can't do, so I
would like to hear other ideas.
Description of the bug
I discovered that if you create a transaction with no
recipient,drain_walletset to false, drain_to set with some scriptpubkey, left allthe other
TxParamsas they are and finish the psbt, you still make atransaction paying the fees for the fixed parts of the transaction and the fees
generated through coin selection.
It doesn't seem to be intentional and it drains funds from your wallet for free
as result.
To Reproduce
I crafted a proof of concept.
Expected behavior
I expect that a psbt without recipients and not used to sweep a descriptor shouldn't be allowed to finalize.
Build environment
5.10.105-1-MANJAROrustc 1.58.1 (db9d1b20b 2022-01-20)cargo 1.58.0 (f01b232bc 2022-01-19)x86_64-unknown-linux-gnuAdditional context
I also attempted a fix in this commit
but there're conflicts with RBF policies.
It seems that
bump_feesetsdrain_walletto false through the use ofDefaultvalues to create the new psbt with the bumped fee.I'm not familiar enough with RBF to know what I can and can't do, so I
would like to hear other ideas.