@@ -356,6 +356,15 @@ impl TxBuilder {
356356 } )
357357 }
358358
359+ /// Replace the internal list of unspendable utxos with a new list. It’s important to note that the "must-be-spent" utxos added with
360+ /// TxBuilder.addUtxo have priority over these. See the Rust docs of the two linked methods for more details.
361+ pub ( crate ) fn unspendable ( & self , unspendable : Vec < OutPoint > ) -> Arc < Self > {
362+ Arc :: new ( TxBuilder {
363+ unspendable : unspendable. into_iter ( ) . collect ( ) ,
364+ ..self . clone ( )
365+ } )
366+ }
367+
359368 /// Add an outpoint to the internal list of UTXOs that must be spent. These have priority over the "unspendable"
360369 /// utxos, meaning that if a utxo is present both in the "utxos" and the "unspendable" list, it will be spent.
361370 pub ( crate ) fn add_utxo ( & self , outpoint : OutPoint ) -> Arc < Self > {
@@ -406,15 +415,6 @@ impl TxBuilder {
406415 } )
407416 }
408417
409- // /// Replace the internal list of unspendable utxos with a new list. It’s important to note that the "must-be-spent" utxos added with
410- // /// TxBuilder.addUtxo have priority over these. See the Rust docs of the two linked methods for more details.
411- // pub(crate) fn unspendable(&self, unspendable: Vec<OutPoint>) -> Arc<Self> {
412- // Arc::new(TxBuilder {
413- // unspendable: unspendable.into_iter().collect(),
414- // ..self.clone()
415- // })
416- // }
417-
418418 /// Set a custom fee rate.
419419 pub ( crate ) fn fee_rate ( & self , sat_per_vb : f32 ) -> Arc < Self > {
420420 Arc :: new ( TxBuilder {
@@ -497,11 +497,11 @@ impl TxBuilder {
497497 let utxos: & [ BdkOutPoint ] = & bdk_utxos;
498498 tx_builder. add_utxos ( utxos) ?;
499499 }
500- // if !self.unspendable.is_empty() {
501- // let bdk_unspendable: Vec<BdkOutPoint> =
502- // self.unspendable.iter().map(BdkOutPoint::from).collect();
503- // tx_builder.unspendable(bdk_unspendable);
504- // }
500+ if !self . unspendable . is_empty ( ) {
501+ let bdk_unspendable: Vec < BdkOutPoint > =
502+ self . unspendable . iter ( ) . map ( BdkOutPoint :: from) . collect ( ) ;
503+ tx_builder. unspendable ( bdk_unspendable) ;
504+ }
505505 if self . manually_selected_only {
506506 tx_builder. manually_selected_only ( ) ;
507507 }
0 commit comments