@@ -1136,7 +1136,7 @@ impl HolderCommitmentTransaction {
11361136 for _ in 0 ..nondust_htlcs. len ( ) {
11371137 counterparty_htlc_sigs. push ( dummy_sig) ;
11381138 }
1139- let inner = CommitmentTransaction :: new ( 0 , 0 , 0 , dummy_key . clone ( ) , dummy_key . clone ( ) , keys, 0 , nondust_htlcs. iter_mut ( ) , & channel_parameters. as_counterparty_broadcastable ( ) ) ;
1139+ let inner = CommitmentTransaction :: new ( 0 , 0 , 0 , keys, 0 , nondust_htlcs. iter_mut ( ) , & channel_parameters. as_counterparty_broadcastable ( ) ) ;
11401140 nondust_htlcs. sort_by_key ( |htlc| htlc. transaction_output_index ) ;
11411141 HolderCommitmentTransaction {
11421142 inner,
@@ -1443,12 +1443,12 @@ impl CommitmentTransaction {
14431443 /// Only include HTLCs that are above the dust limit for the channel.
14441444 ///
14451445 /// This is not exported to bindings users due to the generic though we likely should expose a version without
1446- pub fn new < ' a > ( commitment_number : u64 , to_broadcaster_value_sat : u64 , to_countersignatory_value_sat : u64 , broadcaster_funding_key : PublicKey , countersignatory_funding_key : PublicKey , keys : TxCreationKeys , feerate_per_kw : u32 , nondust_htlcs : impl Iterator < Item = & ' a mut HTLCOutputInCommitment > , channel_parameters : & DirectedChannelTransactionParameters ) -> CommitmentTransaction {
1446+ pub fn new < ' a > ( commitment_number : u64 , to_broadcaster_value_sat : u64 , to_countersignatory_value_sat : u64 , keys : TxCreationKeys , feerate_per_kw : u32 , nondust_htlcs : impl Iterator < Item = & ' a mut HTLCOutputInCommitment > , channel_parameters : & DirectedChannelTransactionParameters ) -> CommitmentTransaction {
14471447 let to_broadcaster_value_sat = Amount :: from_sat ( to_broadcaster_value_sat) ;
14481448 let to_countersignatory_value_sat = Amount :: from_sat ( to_countersignatory_value_sat) ;
14491449
14501450 // Sort outputs and populate output indices while keeping track of the auxiliary data
1451- let ( outputs, nondust_htlcs) = Self :: internal_build_outputs ( & keys, to_broadcaster_value_sat, to_countersignatory_value_sat, nondust_htlcs, channel_parameters, & broadcaster_funding_key , & countersignatory_funding_key ) . unwrap ( ) ;
1451+ let ( outputs, nondust_htlcs) = Self :: internal_build_outputs ( & keys, to_broadcaster_value_sat, to_countersignatory_value_sat, nondust_htlcs, channel_parameters) . unwrap ( ) ;
14521452
14531453 let ( obscured_commitment_transaction_number, txins) = Self :: internal_build_inputs ( commitment_number, channel_parameters) ;
14541454 let transaction = Self :: make_transaction ( obscured_commitment_transaction_number, txins, outputs) ;
@@ -1477,11 +1477,11 @@ impl CommitmentTransaction {
14771477 self
14781478 }
14791479
1480- fn internal_rebuild_transaction ( & self , keys : & TxCreationKeys , channel_parameters : & DirectedChannelTransactionParameters , broadcaster_funding_key : & PublicKey , countersignatory_funding_key : & PublicKey ) -> Result < BuiltCommitmentTransaction , ( ) > {
1480+ fn internal_rebuild_transaction ( & self , keys : & TxCreationKeys , channel_parameters : & DirectedChannelTransactionParameters ) -> Result < BuiltCommitmentTransaction , ( ) > {
14811481 let ( obscured_commitment_transaction_number, txins) = Self :: internal_build_inputs ( self . commitment_number , channel_parameters) ;
14821482
14831483 let mut nondust_htlcs = self . htlcs . clone ( ) ;
1484- let ( outputs, _) = Self :: internal_build_outputs ( keys, self . to_broadcaster_value_sat , self . to_countersignatory_value_sat , nondust_htlcs. iter_mut ( ) , channel_parameters, broadcaster_funding_key , countersignatory_funding_key ) ?;
1484+ let ( outputs, _) = Self :: internal_build_outputs ( keys, self . to_broadcaster_value_sat , self . to_countersignatory_value_sat , nondust_htlcs. iter_mut ( ) , channel_parameters) ?;
14851485
14861486 let transaction = Self :: make_transaction ( obscured_commitment_transaction_number, txins, outputs) ;
14871487 let txid = transaction. compute_txid ( ) ;
@@ -1505,8 +1505,10 @@ impl CommitmentTransaction {
15051505 // - initial sorting of outputs / HTLCs in the constructor, in which case T is auxiliary data the
15061506 // caller needs to have sorted together with the HTLCs so it can keep track of the output index
15071507 // - building of a bitcoin transaction during a verify() call, in which case T is just ()
1508- fn internal_build_outputs < ' a > ( keys : & TxCreationKeys , to_broadcaster_value_sat : Amount , to_countersignatory_value_sat : Amount , nondust_htlcs : impl Iterator < Item = & ' a mut HTLCOutputInCommitment > , channel_parameters : & DirectedChannelTransactionParameters , broadcaster_funding_key : & PublicKey , countersignatory_funding_key : & PublicKey ) -> Result < ( Vec < TxOut > , Vec < HTLCOutputInCommitment > ) , ( ) > {
1508+ fn internal_build_outputs < ' a > ( keys : & TxCreationKeys , to_broadcaster_value_sat : Amount , to_countersignatory_value_sat : Amount , nondust_htlcs : impl Iterator < Item = & ' a mut HTLCOutputInCommitment > , channel_parameters : & DirectedChannelTransactionParameters ) -> Result < ( Vec < TxOut > , Vec < HTLCOutputInCommitment > ) , ( ) > {
15091509 let countersignatory_pubkeys = channel_parameters. countersignatory_pubkeys ( ) ;
1510+ let broadcaster_funding_key = & channel_parameters. broadcaster_pubkeys ( ) . funding_pubkey ;
1511+ let countersignatory_funding_key = & countersignatory_pubkeys. funding_pubkey ;
15101512 let contest_delay = channel_parameters. contest_delay ( ) ;
15111513
15121514 let mut txouts: Vec < ( TxOut , Option < & mut HTLCOutputInCommitment > ) > = Vec :: new ( ) ;
@@ -1680,14 +1682,14 @@ impl CommitmentTransaction {
16801682 ///
16811683 /// An external validating signer must call this method before signing
16821684 /// or using the built transaction.
1683- pub fn verify < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , channel_parameters : & DirectedChannelTransactionParameters , broadcaster_keys : & ChannelPublicKeys , countersignatory_keys : & ChannelPublicKeys , secp_ctx : & Secp256k1 < T > ) -> Result < TrustedCommitmentTransaction , ( ) > {
1685+ pub fn verify < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , channel_parameters : & DirectedChannelTransactionParameters , secp_ctx : & Secp256k1 < T > ) -> Result < TrustedCommitmentTransaction , ( ) > {
16841686 // This is the only field of the key cache that we trust
16851687 let per_commitment_point = self . keys . per_commitment_point ;
1686- let keys = TxCreationKeys :: from_channel_static_keys ( & per_commitment_point, broadcaster_keys , countersignatory_keys , secp_ctx) ;
1688+ let keys = TxCreationKeys :: from_channel_static_keys ( & per_commitment_point, channel_parameters . broadcaster_pubkeys ( ) , channel_parameters . countersignatory_pubkeys ( ) , secp_ctx) ;
16871689 if keys != self . keys {
16881690 return Err ( ( ) ) ;
16891691 }
1690- let tx = self . internal_rebuild_transaction ( & keys, channel_parameters, & broadcaster_keys . funding_pubkey , & countersignatory_keys . funding_pubkey ) ?;
1692+ let tx = self . internal_rebuild_transaction ( & keys, channel_parameters) ?;
16911693 if self . built . transaction != tx. transaction || self . built . txid != tx. txid {
16921694 return Err ( ( ) ) ;
16931695 }
@@ -1910,8 +1912,6 @@ mod tests {
19101912
19111913 struct TestCommitmentTxBuilder {
19121914 commitment_number : u64 ,
1913- holder_funding_pubkey : PublicKey ,
1914- counterparty_funding_pubkey : PublicKey ,
19151915 keys : TxCreationKeys ,
19161916 feerate_per_kw : u32 ,
19171917 nondust_htlcs : Vec < HTLCOutputInCommitment > ,
@@ -1946,8 +1946,6 @@ mod tests {
19461946
19471947 Self {
19481948 commitment_number : 0 ,
1949- holder_funding_pubkey : holder_pubkeys. funding_pubkey ,
1950- counterparty_funding_pubkey : counterparty_pubkeys. funding_pubkey ,
19511949 keys,
19521950 feerate_per_kw : 1 ,
19531951 nondust_htlcs,
@@ -1959,8 +1957,6 @@ mod tests {
19591957 fn build ( & mut self , to_broadcaster_sats : u64 , to_countersignatory_sats : u64 ) -> CommitmentTransaction {
19601958 CommitmentTransaction :: new (
19611959 self . commitment_number , to_broadcaster_sats, to_countersignatory_sats,
1962- self . holder_funding_pubkey . clone ( ) ,
1963- self . counterparty_funding_pubkey . clone ( ) ,
19641960 self . keys . clone ( ) , self . feerate_per_kw ,
19651961 self . nondust_htlcs . iter_mut ( ) , & self . channel_parameters . as_holder_broadcastable ( )
19661962 )
0 commit comments