@@ -1464,7 +1464,7 @@ impl CommitmentTransaction {
14641464 let keys = TxCreationKeys :: from_channel_static_keys ( per_commitment_point, channel_parameters. broadcaster_pubkeys ( ) , channel_parameters. countersignatory_pubkeys ( ) , secp_ctx) ;
14651465
14661466 // Sort outputs and populate output indices
1467- let ( outputs, nondust_htlcs) = Self :: build_outputs_and_htlcs ( & keys, to_broadcaster_value_sat, to_countersignatory_value_sat, nondust_htlcs, channel_parameters) . unwrap ( ) ;
1467+ let ( outputs, nondust_htlcs) = Self :: build_outputs_and_htlcs ( & keys, to_broadcaster_value_sat, to_countersignatory_value_sat, nondust_htlcs, channel_parameters) ;
14681468
14691469 let ( obscured_commitment_transaction_number, txins) = Self :: internal_build_inputs ( commitment_number, channel_parameters) ;
14701470 let transaction = Self :: make_transaction ( obscured_commitment_transaction_number, txins, outputs) ;
@@ -1499,10 +1499,10 @@ impl CommitmentTransaction {
14991499 // and as they'd appear on the commitment transaction.
15001500 // - Maps this vector to a `Vec<TxOut>`, keeping the original order of the outputs.
15011501 // - Then uses the vectors of inputs and outputs to build the commitment transaction.
1502- fn internal_rebuild_transaction ( & self , keys : & TxCreationKeys , channel_parameters : & DirectedChannelTransactionParameters ) -> Result < BuiltCommitmentTransaction , ( ) > {
1502+ fn internal_rebuild_transaction ( & self , keys : & TxCreationKeys , channel_parameters : & DirectedChannelTransactionParameters ) -> BuiltCommitmentTransaction {
15031503 let ( obscured_commitment_transaction_number, txins) = Self :: internal_build_inputs ( self . commitment_number , channel_parameters) ;
15041504
1505- let txout_htlc_pairs = Self :: internal_build_outputs ( keys, self . to_broadcaster_value_sat , self . to_countersignatory_value_sat , self . htlcs ( ) . iter ( ) , channel_parameters) ? ;
1505+ let txout_htlc_pairs = Self :: internal_build_outputs ( keys, self . to_broadcaster_value_sat , self . to_countersignatory_value_sat , self . htlcs ( ) . iter ( ) , channel_parameters) ;
15061506 let outputs = txout_htlc_pairs. into_iter ( ) . map ( |( output, _) | output) . collect ( ) ;
15071507
15081508 let transaction = Self :: make_transaction ( obscured_commitment_transaction_number, txins, outputs) ;
@@ -1511,7 +1511,7 @@ impl CommitmentTransaction {
15111511 transaction,
15121512 txid
15131513 } ;
1514- Ok ( built_transaction)
1514+ built_transaction
15151515 }
15161516
15171517 fn make_transaction ( obscured_commitment_transaction_number : u64 , txins : Vec < TxIn > , outputs : Vec < TxOut > ) -> Transaction {
@@ -1533,9 +1533,9 @@ impl CommitmentTransaction {
15331533 // - Returns the two vectors: the vector of `TxOut`, and the vector of `HTLCOutputInCommitment`:
15341534 // - `Vec<TxOut>` gets moved to the `Transaction` cached by `CommitmentTransaction`,
15351535 // - `Vec<HTLCOutputInCommitment>` gets moved to and cached by `CommitmentTransaction`.
1536- fn build_outputs_and_htlcs ( keys : & TxCreationKeys , to_broadcaster_value_sat : Amount , to_countersignatory_value_sat : Amount , nondust_htlcs : Vec < & mut HTLCOutputInCommitment > , channel_parameters : & DirectedChannelTransactionParameters ) -> Result < ( Vec < TxOut > , Vec < HTLCOutputInCommitment > ) , ( ) > {
1536+ fn build_outputs_and_htlcs ( keys : & TxCreationKeys , to_broadcaster_value_sat : Amount , to_countersignatory_value_sat : Amount , nondust_htlcs : Vec < & mut HTLCOutputInCommitment > , channel_parameters : & DirectedChannelTransactionParameters ) -> ( Vec < TxOut > , Vec < HTLCOutputInCommitment > ) {
15371537 let mut htlcs: Vec < HTLCOutputInCommitment > = Vec :: with_capacity ( nondust_htlcs. len ( ) ) ;
1538- let mut txout_htlc_pairs: Vec < ( TxOut , Option < & mut HTLCOutputInCommitment > ) > = Self :: internal_build_outputs ( keys, to_broadcaster_value_sat, to_countersignatory_value_sat, nondust_htlcs. into_iter ( ) , channel_parameters) ? ;
1538+ let mut txout_htlc_pairs: Vec < ( TxOut , Option < & mut HTLCOutputInCommitment > ) > = Self :: internal_build_outputs ( keys, to_broadcaster_value_sat, to_countersignatory_value_sat, nondust_htlcs. into_iter ( ) , channel_parameters) ;
15391539 let mut outputs: Vec < TxOut > = Vec :: with_capacity ( txout_htlc_pairs. len ( ) ) ;
15401540 for ( idx, out) in txout_htlc_pairs. drain ( ..) . enumerate ( ) {
15411541 if let Some ( htlc) = out. 1 {
@@ -1546,7 +1546,7 @@ impl CommitmentTransaction {
15461546 }
15471547 outputs. push ( out. 0 ) ;
15481548 }
1549- Ok ( ( outputs, htlcs) )
1549+ ( outputs, htlcs)
15501550 }
15511551
15521552 // This function
@@ -1556,7 +1556,7 @@ impl CommitmentTransaction {
15561556 // For the `Option` in the tuple, an HTLC output sets the option to `Some(T)`, and all the other outputs set the option to `None`.
15571557 // - Passes this vector to `sort_outputs` to sort all the tuples in the vector according to the LN specification.
15581558 // - Then returns this sorted vector to the caller.
1559- fn internal_build_outputs < T : Borrow < HTLCOutputInCommitment > > ( keys : & TxCreationKeys , to_broadcaster_value_sat : Amount , to_countersignatory_value_sat : Amount , nondust_htlcs : impl Iterator < Item = T > , channel_parameters : & DirectedChannelTransactionParameters ) -> Result < Vec < ( TxOut , Option < T > ) > , ( ) > {
1559+ fn internal_build_outputs < T : Borrow < HTLCOutputInCommitment > > ( keys : & TxCreationKeys , to_broadcaster_value_sat : Amount , to_countersignatory_value_sat : Amount , nondust_htlcs : impl Iterator < Item = T > , channel_parameters : & DirectedChannelTransactionParameters ) -> Vec < ( TxOut , Option < T > ) > {
15601560 let countersignatory_pubkeys = channel_parameters. countersignatory_pubkeys ( ) ;
15611561 let broadcaster_funding_key = & channel_parameters. broadcaster_pubkeys ( ) . funding_pubkey ;
15621562 let countersignatory_funding_key = & countersignatory_pubkeys. funding_pubkey ;
@@ -1646,7 +1646,7 @@ impl CommitmentTransaction {
16461646 } else { cmp:: Ordering :: Equal }
16471647 } ) ;
16481648
1649- Ok ( txouts)
1649+ txouts
16501650 }
16511651
16521652 fn internal_build_inputs ( commitment_number : u64 , channel_parameters : & DirectedChannelTransactionParameters ) -> ( u64 , Vec < TxIn > ) {
@@ -1732,7 +1732,7 @@ impl CommitmentTransaction {
17321732 if keys != self . keys {
17331733 return Err ( ( ) ) ;
17341734 }
1735- let tx = self . internal_rebuild_transaction ( & keys, channel_parameters) ? ;
1735+ let tx = self . internal_rebuild_transaction ( & keys, channel_parameters) ;
17361736 if self . built . transaction != tx. transaction || self . built . txid != tx. txid {
17371737 return Err ( ( ) ) ;
17381738 }
0 commit comments