@@ -1481,7 +1481,7 @@ impl CommitmentTransaction {
14811481 let keys = TxCreationKeys :: from_channel_static_keys ( per_commitment_point, channel_parameters. broadcaster_pubkeys ( ) , channel_parameters. countersignatory_pubkeys ( ) , secp_ctx) ;
14821482
14831483 // Sort outputs and populate output indices
1484- let ( outputs, nondust_htlcs) = Self :: build_outputs_and_htlcs ( & keys, to_broadcaster_value_sat, to_countersignatory_value_sat, nondust_htlcs, channel_parameters) . unwrap ( ) ;
1484+ let ( outputs, nondust_htlcs) = Self :: build_outputs_and_htlcs ( & keys, to_broadcaster_value_sat, to_countersignatory_value_sat, nondust_htlcs, channel_parameters) ;
14851485
14861486 let ( obscured_commitment_transaction_number, txins) = Self :: internal_build_inputs ( commitment_number, channel_parameters) ;
14871487 let transaction = Self :: make_transaction ( obscured_commitment_transaction_number, txins, outputs) ;
@@ -1516,10 +1516,10 @@ impl CommitmentTransaction {
15161516 // and as they'd appear on the commitment transaction.
15171517 // - Maps this vector to a `Vec<TxOut>`, keeping the original order of the outputs.
15181518 // - Then uses the vectors of inputs and outputs to build the commitment transaction.
1519- fn internal_rebuild_transaction ( & self , keys : & TxCreationKeys , channel_parameters : & DirectedChannelTransactionParameters ) -> Result < BuiltCommitmentTransaction , ( ) > {
1519+ fn internal_rebuild_transaction ( & self , keys : & TxCreationKeys , channel_parameters : & DirectedChannelTransactionParameters ) -> BuiltCommitmentTransaction {
15201520 let ( obscured_commitment_transaction_number, txins) = Self :: internal_build_inputs ( self . commitment_number , channel_parameters) ;
15211521
1522- let txout_htlc_pairs = Self :: internal_build_outputs ( keys, self . to_broadcaster_value_sat , self . to_countersignatory_value_sat , self . htlcs ( ) . iter ( ) , channel_parameters) ? ;
1522+ let txout_htlc_pairs = Self :: internal_build_outputs ( keys, self . to_broadcaster_value_sat , self . to_countersignatory_value_sat , self . htlcs ( ) . iter ( ) , channel_parameters) ;
15231523 let outputs = txout_htlc_pairs. into_iter ( ) . map ( |( output, _) | output) . collect ( ) ;
15241524
15251525 let transaction = Self :: make_transaction ( obscured_commitment_transaction_number, txins, outputs) ;
@@ -1528,7 +1528,7 @@ impl CommitmentTransaction {
15281528 transaction,
15291529 txid
15301530 } ;
1531- Ok ( built_transaction)
1531+ built_transaction
15321532 }
15331533
15341534 fn make_transaction ( obscured_commitment_transaction_number : u64 , txins : Vec < TxIn > , outputs : Vec < TxOut > ) -> Transaction {
@@ -1550,9 +1550,9 @@ impl CommitmentTransaction {
15501550 // - Returns the two vectors: the vector of `TxOut`, and the vector of `HTLCOutputInCommitment`:
15511551 // - `Vec<TxOut>` gets moved to the `Transaction` cached by `CommitmentTransaction`,
15521552 // - `Vec<HTLCOutputInCommitment>` gets moved to and cached by `CommitmentTransaction`.
1553- 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 > ) , ( ) > {
1553+ 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 > ) {
15541554 let mut htlcs: Vec < HTLCOutputInCommitment > = Vec :: with_capacity ( nondust_htlcs. len ( ) ) ;
1555- 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) ? ;
1555+ 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) ;
15561556 let mut outputs: Vec < TxOut > = Vec :: with_capacity ( txout_htlc_pairs. len ( ) ) ;
15571557 for ( idx, out) in txout_htlc_pairs. drain ( ..) . enumerate ( ) {
15581558 if let Some ( htlc) = out. 1 {
@@ -1563,7 +1563,7 @@ impl CommitmentTransaction {
15631563 }
15641564 outputs. push ( out. 0 ) ;
15651565 }
1566- Ok ( ( outputs, htlcs) )
1566+ ( outputs, htlcs)
15671567 }
15681568
15691569 // This function
@@ -1573,7 +1573,7 @@ impl CommitmentTransaction {
15731573 // 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`.
15741574 // - Passes this vector to `sort_outputs` to sort all the tuples in the vector according to the LN specification.
15751575 // - Then returns this sorted vector to the caller.
1576- 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 > ) > , ( ) > {
1576+ 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 > ) > {
15771577 let countersignatory_pubkeys = channel_parameters. countersignatory_pubkeys ( ) ;
15781578 let broadcaster_funding_key = & channel_parameters. broadcaster_pubkeys ( ) . funding_pubkey ;
15791579 let countersignatory_funding_key = & countersignatory_pubkeys. funding_pubkey ;
@@ -1663,7 +1663,7 @@ impl CommitmentTransaction {
16631663 } else { cmp:: Ordering :: Equal }
16641664 } ) ;
16651665
1666- Ok ( txouts)
1666+ txouts
16671667 }
16681668
16691669 fn internal_build_inputs ( commitment_number : u64 , channel_parameters : & DirectedChannelTransactionParameters ) -> ( u64 , Vec < TxIn > ) {
@@ -1749,7 +1749,7 @@ impl CommitmentTransaction {
17491749 if keys != self . keys {
17501750 return Err ( ( ) ) ;
17511751 }
1752- let tx = self . internal_rebuild_transaction ( & keys, channel_parameters) ? ;
1752+ let tx = self . internal_rebuild_transaction ( & keys, channel_parameters) ;
17531753 if self . built . transaction != tx. transaction || self . built . txid != tx. txid {
17541754 return Err ( ( ) ) ;
17551755 }
0 commit comments