@@ -1136,7 +1136,7 @@ impl HolderCommitmentTransaction {
1136
1136
for _ in 0 ..nondust_htlcs. len ( ) {
1137
1137
counterparty_htlc_sigs. push ( dummy_sig) ;
1138
1138
}
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 ( ) ) ;
1140
1140
nondust_htlcs. sort_by_key ( |htlc| htlc. transaction_output_index ) ;
1141
1141
HolderCommitmentTransaction {
1142
1142
inner,
@@ -1443,12 +1443,12 @@ impl CommitmentTransaction {
1443
1443
/// Only include HTLCs that are above the dust limit for the channel.
1444
1444
///
1445
1445
/// 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 {
1447
1447
let to_broadcaster_value_sat = Amount :: from_sat ( to_broadcaster_value_sat) ;
1448
1448
let to_countersignatory_value_sat = Amount :: from_sat ( to_countersignatory_value_sat) ;
1449
1449
1450
1450
// 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 ( ) ;
1452
1452
1453
1453
let ( obscured_commitment_transaction_number, txins) = Self :: internal_build_inputs ( commitment_number, channel_parameters) ;
1454
1454
let transaction = Self :: make_transaction ( obscured_commitment_transaction_number, txins, outputs) ;
@@ -1477,11 +1477,11 @@ impl CommitmentTransaction {
1477
1477
self
1478
1478
}
1479
1479
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 , ( ) > {
1481
1481
let ( obscured_commitment_transaction_number, txins) = Self :: internal_build_inputs ( self . commitment_number , channel_parameters) ;
1482
1482
1483
1483
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) ?;
1485
1485
1486
1486
let transaction = Self :: make_transaction ( obscured_commitment_transaction_number, txins, outputs) ;
1487
1487
let txid = transaction. compute_txid ( ) ;
@@ -1505,8 +1505,10 @@ impl CommitmentTransaction {
1505
1505
// - initial sorting of outputs / HTLCs in the constructor, in which case T is auxiliary data the
1506
1506
// caller needs to have sorted together with the HTLCs so it can keep track of the output index
1507
1507
// - 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 > ) , ( ) > {
1509
1509
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 ;
1510
1512
let contest_delay = channel_parameters. contest_delay ( ) ;
1511
1513
1512
1514
let mut txouts: Vec < ( TxOut , Option < & mut HTLCOutputInCommitment > ) > = Vec :: new ( ) ;
@@ -1680,14 +1682,14 @@ impl CommitmentTransaction {
1680
1682
///
1681
1683
/// An external validating signer must call this method before signing
1682
1684
/// 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 , ( ) > {
1684
1686
// This is the only field of the key cache that we trust
1685
1687
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) ;
1687
1689
if keys != self . keys {
1688
1690
return Err ( ( ) ) ;
1689
1691
}
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) ?;
1691
1693
if self . built . transaction != tx. transaction || self . built . txid != tx. txid {
1692
1694
return Err ( ( ) ) ;
1693
1695
}
@@ -1910,8 +1912,6 @@ mod tests {
1910
1912
1911
1913
struct TestCommitmentTxBuilder {
1912
1914
commitment_number : u64 ,
1913
- holder_funding_pubkey : PublicKey ,
1914
- counterparty_funding_pubkey : PublicKey ,
1915
1915
keys : TxCreationKeys ,
1916
1916
feerate_per_kw : u32 ,
1917
1917
nondust_htlcs : Vec < HTLCOutputInCommitment > ,
@@ -1946,8 +1946,6 @@ mod tests {
1946
1946
1947
1947
Self {
1948
1948
commitment_number : 0 ,
1949
- holder_funding_pubkey : holder_pubkeys. funding_pubkey ,
1950
- counterparty_funding_pubkey : counterparty_pubkeys. funding_pubkey ,
1951
1949
keys,
1952
1950
feerate_per_kw : 1 ,
1953
1951
nondust_htlcs,
@@ -1959,8 +1957,6 @@ mod tests {
1959
1957
fn build ( & mut self , to_broadcaster_sats : u64 , to_countersignatory_sats : u64 ) -> CommitmentTransaction {
1960
1958
CommitmentTransaction :: new (
1961
1959
self . commitment_number , to_broadcaster_sats, to_countersignatory_sats,
1962
- self . holder_funding_pubkey . clone ( ) ,
1963
- self . counterparty_funding_pubkey . clone ( ) ,
1964
1960
self . keys . clone ( ) , self . feerate_per_kw ,
1965
1961
self . nondust_htlcs . iter_mut ( ) , & self . channel_parameters . as_holder_broadcastable ( )
1966
1962
)
0 commit comments