@@ -469,7 +469,7 @@ pub trait CoinSelectionSource {
469
469
) -> Result < CoinSelection , ( ) > ;
470
470
/// Signs and provides the full witness for all inputs within the transaction known to the
471
471
/// trait (i.e., any provided via [`CoinSelectionSource::select_confirmed_utxos`]).
472
- fn sign_tx ( & self , tx : & mut Transaction ) -> Result < ( ) , ( ) > ;
472
+ fn sign_tx ( & self , tx : Transaction ) -> Result < Transaction , ( ) > ;
473
473
}
474
474
475
475
/// An alternative to [`CoinSelectionSource`] that can be implemented and used along [`Wallet`] to
@@ -483,7 +483,7 @@ pub trait WalletSource {
483
483
/// Signs and provides the full [`TxIn::script_sig`] and [`TxIn::witness`] for all inputs within
484
484
/// the transaction known to the wallet (i.e., any provided via
485
485
/// [`WalletSource::list_confirmed_utxos`]).
486
- fn sign_tx ( & self , tx : & mut Transaction ) -> Result < ( ) , ( ) > ;
486
+ fn sign_tx ( & self , tx : Transaction ) -> Result < Transaction , ( ) > ;
487
487
}
488
488
489
489
/// A wrapper over [`WalletSource`] that implements [`CoinSelection`] by preferring UTXOs that would
@@ -629,7 +629,7 @@ where
629
629
. or_else ( |_| do_coin_selection ( true , true ) )
630
630
}
631
631
632
- fn sign_tx ( & self , tx : & mut Transaction ) -> Result < ( ) , ( ) > {
632
+ fn sign_tx ( & self , tx : Transaction ) -> Result < Transaction , ( ) > {
633
633
self . source . sign_tx ( tx)
634
634
}
635
635
}
@@ -748,7 +748,8 @@ where
748
748
let unsigned_tx_weight = anchor_tx. weight ( ) as u64 - ( anchor_tx. input . len ( ) as u64 * EMPTY_SCRIPT_SIG_WEIGHT ) ;
749
749
750
750
log_debug ! ( self . logger, "Signing anchor transaction {}" , anchor_txid) ;
751
- self . utxo_source . sign_tx ( & mut anchor_tx) ?;
751
+ anchor_tx = self . utxo_source . sign_tx ( anchor_tx) ?;
752
+
752
753
let signer = anchor_descriptor. derive_channel_signer ( & self . signer_provider ) ;
753
754
let anchor_sig = signer. sign_holder_anchor_input ( & anchor_tx, 0 , & self . secp ) ?;
754
755
anchor_tx. input [ 0 ] . witness = anchor_descriptor. tx_input_witness ( & anchor_sig) ;
@@ -812,7 +813,8 @@ where
812
813
let unsigned_tx_weight = htlc_tx. weight ( ) as u64 - ( htlc_tx. input . len ( ) as u64 * EMPTY_SCRIPT_SIG_WEIGHT ) ;
813
814
814
815
log_debug ! ( self . logger, "Signing HTLC transaction {}" , htlc_tx. txid( ) ) ;
815
- self . utxo_source . sign_tx ( & mut htlc_tx) ?;
816
+ htlc_tx = self . utxo_source . sign_tx ( htlc_tx) ?;
817
+
816
818
let mut signers = BTreeMap :: new ( ) ;
817
819
for ( idx, htlc_descriptor) in htlc_descriptors. iter ( ) . enumerate ( ) {
818
820
let signer = signers. entry ( htlc_descriptor. channel_derivation_parameters . keys_id )
0 commit comments