]> Untitled Git - bdk/commitdiff
fix(wallet): use `map_keychain` in `Wallet::build_fee_bump`
authorvalued mammal <valuedmammal@protonmail.com>
Fri, 24 Jan 2025 14:13:08 +0000 (09:13 -0500)
committervalued mammal <valuedmammal@protonmail.com>
Fri, 24 Jan 2025 14:13:08 +0000 (09:13 -0500)
Previously we failed to remove the change output if the wallet has
no internal keychain which caused tx building to fail at the new
higher feerate. Fix this by mapping the internal keychain to the
de-facto change keychain so that the drain output can be
recalculated.

crates/wallet/src/wallet/mod.rs

index 70d26c08040b5e1b50034550f42505fa3938e687..3d60aa2ecbd4a0bc66396f3ffccf74c4ae794c5f 100644 (file)
@@ -1676,7 +1676,7 @@ impl Wallet {
         if tx.output.len() > 1 {
             let mut change_index = None;
             for (index, txout) in tx.output.iter().enumerate() {
-                let change_keychain = KeychainKind::Internal;
+                let change_keychain = self.map_keychain(KeychainKind::Internal);
                 match txout_index.index_of_spk(txout.script_pubkey.clone()) {
                     Some((keychain, _)) if *keychain == change_keychain => {
                         change_index = Some(index)