Using build_fee_bump to replace transaction along with allow_shrinking results in the specified address output amount increasing and consuming all of the input utxo amount.
To Reproduce
Create a transaction with one output ADDRESS and specify an x amount to be sent. sign and broadcast.
Sync wallet. Create a bump fee txbuilder and call allow_shrinking(ADDRESS) and specify a higher feerate fee_rate
Example Code:
fn create_original_tx(){
let (wallet, blockchain) = init();
wallet.sync(&blockchain, SyncOptions::default()).unwrap();
let addr = bdk::bitcoin::Address::from_str("bcrt1q6m7tyf45hd5swf7ug5f3r35y6htga0m2tlxhfh").unwrap();
println!("Descriptor balance: {} SAT", wallet.get_balance().unwrap());
let script = addr.script_pubkey().clone();
let mut tx_builder = wallet.build_tx();
tx_builder
.add_recipient(script.clone(), 10000)
.fee_rate(FeeRate::from_sat_per_vb(1.0))
.enable_rbf();
let (mut psbt, _tx_details) = tx_builder.finish().unwrap();
let finalized = wallet.sign(&mut psbt, bdk::SignOptions::default()).unwrap();
assert!(finalized, "we should have signed all the inputs");
let tx = psbt.clone().extract_tx();
blockchain.broadcast(&tx).unwrap();
let txid = psbt.extract_tx().txid();
println!("Txid:{:?}",txid );
}
fn build_bump_psbt(){
let (wallet, blockchain) = init();
let addr = bdk::bitcoin::Address::from_str("bcrt1q6m7tyf45hd5swf7ug5f3r35y6htga0m2tlxhfh").unwrap();
wallet.sync(&blockchain, SyncOptions::default()).unwrap();
let mut tx_builder = wallet.build_fee_bump(Txid::from_str("f8f8d1e566eb2ae963825628e4a3ef249a82aa71b8bfb5389b5d935d8864eebe").unwrap()).unwrap();
tx_builder
.allow_shrinking(addr.script_pubkey()).unwrap()
.fee_rate(FeeRate::from_sat_per_vb(2.5));
let (mut psbt, _tx_details) = tx_builder.finish().unwrap();
let finalized = wallet.sign(&mut psbt, bdk::SignOptions::default()).unwrap();
assert!(finalized, "we should have signed all the inputs");
let tx = psbt.clone().extract_tx();
blockchain.broadcast(&tx).unwrap();
let txid = psbt.extract_tx().txid();
println!("Txid2 :{:?}",txid );
}
Expected behavior
Expect the output ADDRESS to have the same amount or less. Amount will be less if the input transaction cannot cover the fee as well as the originally specified amount for ADDRESS
However output ADDRESS is having a higher amount than the origincal. It is actually consuming all the input amount.
Build environment
- BDK v0.28.2
- macOS 13.2
- Rust/Cargo version: 1.76.0
Additional context
Original transaction outputs

Transaction outputs after fee bump and allow shrinking:

Using
build_fee_bumpto replace transaction along withallow_shrinkingresults in the specified address output amount increasing and consuming all of the input utxo amount.To Reproduce
Create a transaction with one output ADDRESS and specify an x amount to be sent. sign and broadcast.
Sync wallet. Create a bump fee txbuilder and call allow_shrinking(ADDRESS) and specify a higher feerate fee_rate
Example Code:
Expected behavior
Expect the output ADDRESS to have the same amount or less. Amount will be less if the input transaction cannot cover the fee as well as the originally specified amount for ADDRESS
However output ADDRESS is having a higher amount than the origincal. It is actually consuming all the input amount.
Build environment
Additional context
Original transaction outputs

Transaction outputs after fee bump and allow shrinking:
