From: valued mammal Date: Fri, 24 Jan 2025 14:13:08 +0000 (-0500) Subject: fix(wallet): use `map_keychain` in `Wallet::build_fee_bump` X-Git-Tag: bitcoind_rpc-0.18.0~4^2~1 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/scripts/static/enum.ApplyHeaderError.html?a=commitdiff_plain;h=53d16e1b38eabee1f1ca304933a818951b8b0f43;p=bdk fix(wallet): use `map_keychain` in `Wallet::build_fee_bump` 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. --- diff --git a/crates/wallet/src/wallet/mod.rs b/crates/wallet/src/wallet/mod.rs index 70d26c08..3d60aa2e 100644 --- a/crates/wallet/src/wallet/mod.rs +++ b/crates/wallet/src/wallet/mod.rs @@ -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)