@@ -1161,7 +1161,7 @@ impl HolderCommitmentTransaction {
1161
1161
for _ in 0 ..htlcs. len ( ) {
1162
1162
counterparty_htlc_sigs. push ( dummy_sig) ;
1163
1163
}
1164
- let inner = CommitmentTransaction :: new_with_auxiliary_htlc_data ( 0 , 0 , 0 , dummy_key . clone ( ) , dummy_key . clone ( ) , keys, 0 , htlcs, & channel_parameters. as_counterparty_broadcastable ( ) ) ;
1164
+ let inner = CommitmentTransaction :: new_with_auxiliary_htlc_data ( 0 , 0 , 0 , keys, 0 , htlcs, & channel_parameters. as_counterparty_broadcastable ( ) ) ;
1165
1165
htlcs. sort_by_key ( |htlc| htlc. 0 . transaction_output_index ) ;
1166
1166
HolderCommitmentTransaction {
1167
1167
inner,
@@ -1471,12 +1471,12 @@ impl CommitmentTransaction {
1471
1471
/// Only include HTLCs that are above the dust limit for the channel.
1472
1472
///
1473
1473
/// This is not exported to bindings users due to the generic though we likely should expose a version without
1474
- pub fn new_with_auxiliary_htlc_data < T > ( 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 , htlcs_with_aux : & mut Vec < ( HTLCOutputInCommitment , T ) > , channel_parameters : & DirectedChannelTransactionParameters ) -> CommitmentTransaction {
1474
+ pub fn new_with_auxiliary_htlc_data < T > ( commitment_number : u64 , to_broadcaster_value_sat : u64 , to_countersignatory_value_sat : u64 , keys : TxCreationKeys , feerate_per_kw : u32 , htlcs_with_aux : & mut Vec < ( HTLCOutputInCommitment , T ) > , channel_parameters : & DirectedChannelTransactionParameters ) -> CommitmentTransaction {
1475
1475
let to_broadcaster_value_sat = Amount :: from_sat ( to_broadcaster_value_sat) ;
1476
1476
let to_countersignatory_value_sat = Amount :: from_sat ( to_countersignatory_value_sat) ;
1477
1477
1478
1478
// Sort outputs and populate output indices while keeping track of the auxiliary data
1479
- let ( outputs, htlcs) = Self :: internal_build_outputs ( & keys, to_broadcaster_value_sat, to_countersignatory_value_sat, htlcs_with_aux, channel_parameters, & broadcaster_funding_key , & countersignatory_funding_key ) . unwrap ( ) ;
1479
+ let ( outputs, htlcs) = Self :: internal_build_outputs ( & keys, to_broadcaster_value_sat, to_countersignatory_value_sat, htlcs_with_aux, channel_parameters) . unwrap ( ) ;
1480
1480
1481
1481
let ( obscured_commitment_transaction_number, txins) = Self :: internal_build_inputs ( commitment_number, channel_parameters) ;
1482
1482
let transaction = Self :: make_transaction ( obscured_commitment_transaction_number, txins, outputs) ;
@@ -1505,11 +1505,11 @@ impl CommitmentTransaction {
1505
1505
self
1506
1506
}
1507
1507
1508
- fn internal_rebuild_transaction ( & self , keys : & TxCreationKeys , channel_parameters : & DirectedChannelTransactionParameters , broadcaster_funding_key : & PublicKey , countersignatory_funding_key : & PublicKey ) -> Result < BuiltCommitmentTransaction , ( ) > {
1508
+ fn internal_rebuild_transaction ( & self , keys : & TxCreationKeys , channel_parameters : & DirectedChannelTransactionParameters ) -> Result < BuiltCommitmentTransaction , ( ) > {
1509
1509
let ( obscured_commitment_transaction_number, txins) = Self :: internal_build_inputs ( self . commitment_number , channel_parameters) ;
1510
1510
1511
1511
let mut htlcs_with_aux = self . htlcs . iter ( ) . map ( |h| ( h. clone ( ) , ( ) ) ) . collect ( ) ;
1512
- let ( outputs, _) = Self :: internal_build_outputs ( keys, self . to_broadcaster_value_sat , self . to_countersignatory_value_sat , & mut htlcs_with_aux, channel_parameters, broadcaster_funding_key , countersignatory_funding_key ) ?;
1512
+ let ( outputs, _) = Self :: internal_build_outputs ( keys, self . to_broadcaster_value_sat , self . to_countersignatory_value_sat , & mut htlcs_with_aux, channel_parameters) ?;
1513
1513
1514
1514
let transaction = Self :: make_transaction ( obscured_commitment_transaction_number, txins, outputs) ;
1515
1515
let txid = transaction. compute_txid ( ) ;
@@ -1533,8 +1533,10 @@ impl CommitmentTransaction {
1533
1533
// - initial sorting of outputs / HTLCs in the constructor, in which case T is auxiliary data the
1534
1534
// caller needs to have sorted together with the HTLCs so it can keep track of the output index
1535
1535
// - building of a bitcoin transaction during a verify() call, in which case T is just ()
1536
- fn internal_build_outputs < T > ( keys : & TxCreationKeys , to_broadcaster_value_sat : Amount , to_countersignatory_value_sat : Amount , htlcs_with_aux : & mut Vec < ( HTLCOutputInCommitment , T ) > , channel_parameters : & DirectedChannelTransactionParameters , broadcaster_funding_key : & PublicKey , countersignatory_funding_key : & PublicKey ) -> Result < ( Vec < TxOut > , Vec < HTLCOutputInCommitment > ) , ( ) > {
1536
+ fn internal_build_outputs < T > ( keys : & TxCreationKeys , to_broadcaster_value_sat : Amount , to_countersignatory_value_sat : Amount , htlcs_with_aux : & mut Vec < ( HTLCOutputInCommitment , T ) > , channel_parameters : & DirectedChannelTransactionParameters ) -> Result < ( Vec < TxOut > , Vec < HTLCOutputInCommitment > ) , ( ) > {
1537
1537
let countersignatory_pubkeys = channel_parameters. countersignatory_pubkeys ( ) ;
1538
+ let broadcaster_funding_key = & channel_parameters. broadcaster_pubkeys ( ) . funding_pubkey ;
1539
+ let countersignatory_funding_key = & countersignatory_pubkeys. funding_pubkey ;
1538
1540
let contest_delay = channel_parameters. contest_delay ( ) ;
1539
1541
1540
1542
let mut txouts: Vec < ( TxOut , Option < & mut HTLCOutputInCommitment > ) > = Vec :: new ( ) ;
@@ -1706,14 +1708,14 @@ impl CommitmentTransaction {
1706
1708
///
1707
1709
/// An external validating signer must call this method before signing
1708
1710
/// or using the built transaction.
1709
- pub fn verify < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , channel_parameters : & DirectedChannelTransactionParameters , broadcaster_keys : & ChannelPublicKeys , countersignatory_keys : & ChannelPublicKeys , secp_ctx : & Secp256k1 < T > ) -> Result < TrustedCommitmentTransaction , ( ) > {
1711
+ pub fn verify < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , channel_parameters : & DirectedChannelTransactionParameters , secp_ctx : & Secp256k1 < T > ) -> Result < TrustedCommitmentTransaction , ( ) > {
1710
1712
// This is the only field of the key cache that we trust
1711
1713
let per_commitment_point = self . keys . per_commitment_point ;
1712
- let keys = TxCreationKeys :: from_channel_static_keys ( & per_commitment_point, broadcaster_keys , countersignatory_keys , secp_ctx) ;
1714
+ let keys = TxCreationKeys :: from_channel_static_keys ( & per_commitment_point, channel_parameters . broadcaster_pubkeys ( ) , channel_parameters . countersignatory_pubkeys ( ) , secp_ctx) ;
1713
1715
if keys != self . keys {
1714
1716
return Err ( ( ) ) ;
1715
1717
}
1716
- let tx = self . internal_rebuild_transaction ( & keys, channel_parameters, & broadcaster_keys . funding_pubkey , & countersignatory_keys . funding_pubkey ) ?;
1718
+ let tx = self . internal_rebuild_transaction ( & keys, channel_parameters) ?;
1717
1719
if self . built . transaction != tx. transaction || self . built . txid != tx. txid {
1718
1720
return Err ( ( ) ) ;
1719
1721
}
@@ -1936,8 +1938,6 @@ mod tests {
1936
1938
1937
1939
struct TestCommitmentTxBuilder {
1938
1940
commitment_number : u64 ,
1939
- holder_funding_pubkey : PublicKey ,
1940
- counterparty_funding_pubkey : PublicKey ,
1941
1941
keys : TxCreationKeys ,
1942
1942
feerate_per_kw : u32 ,
1943
1943
htlcs_with_aux : Vec < ( HTLCOutputInCommitment , ( ) ) > ,
@@ -1973,8 +1973,6 @@ mod tests {
1973
1973
1974
1974
Self {
1975
1975
commitment_number : 0 ,
1976
- holder_funding_pubkey : holder_pubkeys. funding_pubkey ,
1977
- counterparty_funding_pubkey : counterparty_pubkeys. funding_pubkey ,
1978
1976
keys,
1979
1977
feerate_per_kw : 1 ,
1980
1978
htlcs_with_aux,
@@ -1986,8 +1984,6 @@ mod tests {
1986
1984
fn build ( & mut self , to_broadcaster_sats : u64 , to_countersignatory_sats : u64 ) -> CommitmentTransaction {
1987
1985
CommitmentTransaction :: new_with_auxiliary_htlc_data (
1988
1986
self . commitment_number , to_broadcaster_sats, to_countersignatory_sats,
1989
- self . holder_funding_pubkey . clone ( ) ,
1990
- self . counterparty_funding_pubkey . clone ( ) ,
1991
1987
self . keys . clone ( ) , self . feerate_per_kw ,
1992
1988
& mut self . htlcs_with_aux , & self . channel_parameters . as_holder_broadcastable ( )
1993
1989
)
0 commit comments