@@ -33,7 +33,7 @@ use wallet::{
33
33
} ,
34
34
DoubleUtxo , SpacesWallet , WalletInfo ,
35
35
} ;
36
-
36
+ use wallet :: bdk_wallet :: wallet :: tx_builder :: TxOrdering ;
37
37
use crate :: {
38
38
config:: ExtendedNetwork ,
39
39
node:: BlockSource ,
@@ -177,12 +177,20 @@ impl RpcWallet {
177
177
178
178
fn handle_fee_bump (
179
179
source : & BitcoinBlockSource ,
180
+ state : & mut LiveSnapshot ,
180
181
wallet : & mut SpacesWallet ,
181
182
txid : Txid ,
182
183
fee_rate : FeeRate ,
183
184
) -> anyhow:: Result < Vec < TxResponse > > {
184
- let mut builder = wallet. spaces . build_fee_bump ( txid) ?;
185
- builder. fee_rate ( fee_rate) ;
185
+ let coin_selection = Self :: get_spaces_coin_selection ( wallet, state) ?;
186
+ let mut builder = wallet. spaces
187
+ . build_fee_bump ( txid) ?
188
+ . coin_selection ( coin_selection) ;
189
+
190
+ builder
191
+ . enable_rbf ( )
192
+ . ordering ( TxOrdering :: Untouched )
193
+ . fee_rate ( fee_rate) ;
186
194
187
195
let psbt = builder. finish ( ) ?;
188
196
let tx = wallet. sign ( psbt, None ) ?;
@@ -200,17 +208,21 @@ impl RpcWallet {
200
208
201
209
fn handle_force_spend_output (
202
210
source : & BitcoinBlockSource ,
211
+ state : & mut LiveSnapshot ,
203
212
wallet : & mut SpacesWallet ,
204
213
output : OutPoint ,
205
214
fee_rate : FeeRate ,
206
215
) -> anyhow:: Result < TxResponse > {
216
+ let coin_selection = Self :: get_spaces_coin_selection ( wallet, state) ?;
207
217
let addre = wallet. spaces . next_unused_address ( KeychainKind :: External ) ;
208
218
let mut builder = wallet
209
219
. spaces
210
220
. build_tx ( )
211
- . coin_selection ( SpacesAwareCoinSelection :: new ( vec ! [ ] ) ) ;
221
+ . coin_selection ( coin_selection ) ;
212
222
223
+ builder. ordering ( TxOrdering :: Untouched ) ;
213
224
builder. fee_rate ( fee_rate) ;
225
+ builder. enable_rbf ( ) ;
214
226
builder. add_utxo ( output) ?;
215
227
builder. add_recipient ( addre. script_pubkey ( ) , Amount :: from_sat ( 5000 ) ) ;
216
228
@@ -247,15 +259,15 @@ impl RpcWallet {
247
259
fee_rate,
248
260
resp,
249
261
} => {
250
- let result = Self :: handle_fee_bump ( source, wallet, txid, fee_rate) ;
262
+ let result = Self :: handle_fee_bump ( source, & mut state , wallet, txid, fee_rate) ;
251
263
_ = resp. send ( result) ;
252
264
}
253
265
WalletCommand :: ForceSpendOutput {
254
266
outpoint,
255
267
fee_rate,
256
268
resp,
257
269
} => {
258
- let result = Self :: handle_force_spend_output ( source, wallet, outpoint, fee_rate) ;
270
+ let result = Self :: handle_force_spend_output ( source, & mut state , wallet, outpoint, fee_rate) ;
259
271
_ = resp. send ( result) ;
260
272
}
261
273
WalletCommand :: GetNewAddress { kind, resp } => {
0 commit comments