@@ -24,7 +24,7 @@ use crate::ln::LN_MAX_MSG_LEN;
2424use crate :: prelude:: * ;
2525use crate :: util:: native_async:: MaybeSend ;
2626use crate :: util:: wallet_utils:: {
27- CoinSelection , CoinSelectionSource , CoinSelectionSourceSync , Input ,
27+ CoinSelection , CoinSelectionSource , CoinSelectionSourceSync , ConfirmedUtxo , Input ,
2828} ;
2929
3030/// Error returned when a [`FundingContribution`] cannot be adjusted to a target feerate.
@@ -370,7 +370,7 @@ impl FundingTemplate {
370370 /// when that is set. `max_feerate` is the highest feerate we are willing to tolerate if we end
371371 /// up as the acceptor, and must be at least `min_feerate`.
372372 pub fn splice_in_inputs (
373- self , inputs : Vec < FundingTxInput > , min_feerate : FeeRate , max_feerate : FeeRate ,
373+ self , inputs : Vec < ConfirmedUtxo > , min_feerate : FeeRate , max_feerate : FeeRate ,
374374 ) -> Result < FundingContribution , FundingContributionError > {
375375 self . with_prior_contribution ( min_feerate, max_feerate) . add_inputs ( inputs) ?. build ( )
376376 }
@@ -466,8 +466,8 @@ impl FundingTemplate {
466466}
467467
468468fn estimate_transaction_fee (
469- inputs : & [ FundingTxInput ] , outputs : & [ TxOut ] , change_output : Option < & TxOut > ,
470- is_initiator : bool , is_splice : bool , feerate : FeeRate ,
469+ inputs : & [ ConfirmedUtxo ] , outputs : & [ TxOut ] , change_output : Option < & TxOut > , is_initiator : bool ,
470+ is_splice : bool , feerate : FeeRate ,
471471) -> Amount {
472472 let input_weight: u64 = inputs
473473 . iter ( )
@@ -515,7 +515,7 @@ fn estimate_transaction_fee(
515515 Weight :: from_wu ( weight) * feerate
516516}
517517
518- fn validate_inputs ( inputs : & [ FundingTxInput ] ) -> Result < ( ) , FundingContributionError > {
518+ fn validate_inputs ( inputs : & [ ConfirmedUtxo ] ) -> Result < ( ) , FundingContributionError > {
519519 let mut total_value = Amount :: ZERO ;
520520 for ( idx, input) in inputs. iter ( ) . enumerate ( ) {
521521 if inputs[ ..idx]
@@ -559,7 +559,7 @@ enum FundingInputs {
559559 /// Replaces the contribution's inputs with the provided set and fully consumes them without a
560560 /// change output. The amount added to the channel is recomputed from the input total minus fees,
561561 /// while explicit withdrawal outputs still reduce the splice's net value.
562- ManuallySelected { inputs : Vec < FundingTxInput > } ,
562+ ManuallySelected { inputs : Vec < ConfirmedUtxo > } ,
563563}
564564
565565impl FundingInputs {
@@ -584,7 +584,7 @@ impl FundingInputs {
584584 }
585585 }
586586
587- fn manually_selected_inputs ( & self ) -> & [ FundingTxInput ] {
587+ fn manually_selected_inputs ( & self ) -> & [ ConfirmedUtxo ] {
588588 match self {
589589 FundingInputs :: ManuallySelected { inputs } => inputs,
590590 FundingInputs :: CoinSelected { .. } => & [ ] ,
@@ -613,7 +613,7 @@ pub struct FundingContribution {
613613 ///
614614 /// For coin-selected contributions, excess value is returned via [`Self::change_output`]. For
615615 /// manually selected inputs, the full input value is consumed and no change output is created.
616- inputs : Vec < FundingTxInput > ,
616+ inputs : Vec < ConfirmedUtxo > ,
617617
618618 /// The outputs to include in the funding transaction.
619619 ///
@@ -691,7 +691,7 @@ impl FundingContribution {
691691 }
692692
693693 /// Returns the inputs included in this contribution.
694- pub fn inputs ( & self ) -> & [ FundingTxInput ] {
694+ pub fn inputs ( & self ) -> & [ ConfirmedUtxo ] {
695695 & self . inputs
696696 }
697697
@@ -827,7 +827,7 @@ impl FundingContribution {
827827 Some ( new_contribution_at_target_feerate)
828828 }
829829
830- pub ( super ) fn into_tx_parts ( self ) -> ( Vec < FundingTxInput > , Vec < TxOut > ) {
830+ pub ( super ) fn into_tx_parts ( self ) -> ( Vec < ConfirmedUtxo > , Vec < TxOut > ) {
831831 let FundingContribution { inputs, mut outputs, change_output, .. } = self ;
832832
833833 if let Some ( change_output) = change_output {
@@ -1131,10 +1131,6 @@ impl FundingContribution {
11311131 }
11321132}
11331133
1134- /// An input to contribute to a channel's funding transaction either when using the v2 channel
1135- /// establishment protocol or when splicing.
1136- pub type FundingTxInput = crate :: util:: wallet_utils:: ConfirmedUtxo ;
1137-
11381134#[ derive( Debug , Clone , PartialEq , Eq ) ]
11391135struct NoCoinSelectionSource ;
11401136#[ derive( Debug , Clone , PartialEq , Eq ) ]
@@ -1472,7 +1468,7 @@ impl FundingBuilder {
14721468 ///
14731469 /// Returns [`FundingContributionError::InvalidSpliceValue`] if the builder already has a
14741470 /// coin-selected value request.
1475- pub fn add_input ( self , input : FundingTxInput ) -> Result < Self , FundingContributionError > {
1471+ pub fn add_input ( self , input : ConfirmedUtxo ) -> Result < Self , FundingContributionError > {
14761472 self . 0 . add_input_inner ( input) . map ( FundingBuilder )
14771473 }
14781474
@@ -1490,7 +1486,7 @@ impl FundingBuilder {
14901486 ///
14911487 /// Returns [`FundingContributionError::InvalidSpliceValue`] if the builder already has a
14921488 /// coin-selected value request.
1493- pub fn add_inputs ( self , inputs : Vec < FundingTxInput > ) -> Result < Self , FundingContributionError > {
1489+ pub fn add_inputs ( self , inputs : Vec < ConfirmedUtxo > ) -> Result < Self , FundingContributionError > {
14941490 self . 0 . add_inputs_inner ( inputs) . map ( FundingBuilder )
14951491 }
14961492
@@ -1585,7 +1581,7 @@ impl<State> FundingBuilderInner<State> {
15851581 Ok ( self )
15861582 }
15871583
1588- fn add_input_inner ( mut self , input : FundingTxInput ) -> Result < Self , FundingContributionError > {
1584+ fn add_input_inner ( mut self , input : ConfirmedUtxo ) -> Result < Self , FundingContributionError > {
15891585 match & mut self . funding_inputs {
15901586 None => {
15911587 self . funding_inputs = Some ( FundingInputs :: ManuallySelected { inputs : vec ! [ input] } )
@@ -1599,7 +1595,7 @@ impl<State> FundingBuilderInner<State> {
15991595 }
16001596
16011597 fn add_inputs_inner (
1602- mut self , inputs : Vec < FundingTxInput > ,
1598+ mut self , inputs : Vec < ConfirmedUtxo > ,
16031599 ) -> Result < Self , FundingContributionError > {
16041600 match & mut self . funding_inputs {
16051601 None => self . funding_inputs = Some ( FundingInputs :: ManuallySelected { inputs } ) ,
@@ -1875,11 +1871,11 @@ impl<W: CoinSelectionSourceSync> SyncFundingBuilder<W> {
18751871mod tests {
18761872 use super :: {
18771873 estimate_transaction_fee, FeeRateAdjustmentError , FundingBuilder , FundingContribution ,
1878- FundingContributionError , FundingInputMode , FundingTemplate , FundingTxInput ,
1879- SyncCoinSelectionSource , SyncFundingBuilder ,
1874+ FundingContributionError , FundingInputMode , FundingTemplate , SyncCoinSelectionSource ,
1875+ SyncFundingBuilder ,
18801876 } ;
18811877 use crate :: chain:: ClaimId ;
1882- use crate :: util:: wallet_utils:: { CoinSelection , CoinSelectionSourceSync , Input } ;
1878+ use crate :: util:: wallet_utils:: { CoinSelection , CoinSelectionSourceSync , ConfirmedUtxo , Input } ;
18831879 use bitcoin:: hashes:: Hash ;
18841880 use bitcoin:: transaction:: { Transaction , TxOut , Version } ;
18851881 use bitcoin:: { Amount , FeeRate , Psbt , ScriptBuf , SignedAmount , WPubkeyHash , WScriptHash } ;
@@ -1960,7 +1956,7 @@ mod tests {
19601956 }
19611957
19621958 #[ rustfmt:: skip]
1963- fn funding_input_sats ( input_value_sats : u64 ) -> FundingTxInput {
1959+ fn funding_input_sats ( input_value_sats : u64 ) -> ConfirmedUtxo {
19641960 let prevout = TxOut {
19651961 value : Amount :: from_sat ( input_value_sats) ,
19661962 script_pubkey : ScriptBuf :: new_p2wpkh ( & WPubkeyHash :: all_zeros ( ) ) ,
@@ -1970,7 +1966,7 @@ mod tests {
19701966 version : Version :: TWO , lock_time : bitcoin:: absolute:: LockTime :: ZERO ,
19711967 } ;
19721968
1973- FundingTxInput :: new_p2wpkh ( prevtx, 0 ) . unwrap ( )
1969+ ConfirmedUtxo :: new_p2wpkh ( prevtx, 0 ) . unwrap ( )
19741970 }
19751971
19761972 fn funding_output_sats ( output_value_sats : u64 ) -> TxOut {
@@ -1995,7 +1991,7 @@ mod tests {
19951991 }
19961992
19971993 struct MustPayToWallet {
1998- utxo : FundingTxInput ,
1994+ utxo : ConfirmedUtxo ,
19991995 change_output : Option < TxOut > ,
20001996 expected_must_pay_to_values : Vec < Amount > ,
20011997 }
@@ -2805,7 +2801,7 @@ mod tests {
28052801 assert ! ( prevtx. serialized_length( ) > crate :: ln:: LN_MAX_MSG_LEN ) ;
28062802
28072803 let wallet = SingleUtxoWallet {
2808- utxo : FundingTxInput :: new_p2wpkh ( prevtx, 0 ) . unwrap ( ) ,
2804+ utxo : ConfirmedUtxo :: new_p2wpkh ( prevtx, 0 ) . unwrap ( ) ,
28092805 change_output : None ,
28102806 } ;
28112807 assert ! ( matches!(
@@ -3713,7 +3709,7 @@ mod tests {
37133709
37143710 /// A mock wallet that returns a single UTXO for coin selection.
37153711 struct SingleUtxoWallet {
3716- utxo : FundingTxInput ,
3712+ utxo : ConfirmedUtxo ,
37173713 change_output : Option < TxOut > ,
37183714 }
37193715
0 commit comments