Describe the bug
bdk-cli wallet … combine_psbt discards the error from Psbt::combine, so when two PSBTs are incompatible (different unsigned transactions) the command exits 0 and prints a "combined" PSBT that is silently missing the other PSBT's inputs/signatures, instead of failing.
The fold that merges the PSBTs discards each combine result:
let final_psbt = psbts.into_iter().try_fold::<_, _, Result<Psbt, Error>>(
init_psbt,
|mut acc, x| {
let _ = acc.combine(x); // error dropped here
Ok(acc)
},
)?;
Per BIP174, Psbt::combine returns Err whenever the two PSBTs don't describe the same unsigned transaction (different txids/outputs).
To Reproduce
Two PSBTs with different unsigned transactions (BIP174-incompatible):
bdk-cli wallet -w demo combine_psbt $A $B
# exit 0; output == B, with A silently dropped
bdk-cli wallet -w demo combine_psbt $A $A
# control: valid combine, output == A
Expected behavior
- non-zero exit and an error explaining the PSBTs could not be combined.
Build environment
- BDK-CLI tag/commit: bdk-cli v4.0.0 bdk-cli 5b3cb00
Additional context
Describe the bug
bdk-cli wallet … combine_psbt discards the error from Psbt::combine, so when two PSBTs are incompatible (different unsigned transactions) the command exits 0 and prints a "combined" PSBT that is silently missing the other PSBT's inputs/signatures, instead of failing.
The fold that merges the PSBTs discards each combine result:
Per BIP174, Psbt::combine returns Err whenever the two PSBTs don't describe the same unsigned transaction (different txids/outputs).
To Reproduce
Two PSBTs with different unsigned transactions (BIP174-incompatible):
Expected behavior
Build environment
Additional context