@@ -1120,8 +1120,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1120
1120
/// pays to get_funding_redeemscript().to_v0_p2wsh()).
1121
1121
/// Panics if called before accept_channel/new_from_req
1122
1122
pub fn get_funding_redeemscript ( & self ) -> Script {
1123
- let our_funding_key = PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . funding_key ( ) ) ;
1124
- make_funding_redeemscript ( & our_funding_key, self . their_funding_pubkey ( ) )
1123
+ make_funding_redeemscript ( & self . local_keys . pubkeys ( ) . funding_pubkey , self . their_funding_pubkey ( ) )
1125
1124
}
1126
1125
1127
1126
/// Builds the htlc-success or htlc-timeout transaction which spends a given HTLC output
@@ -1455,7 +1454,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1455
1454
log_trace ! ( logger, "Checking funding_created tx signature {} by key {} against tx {} (sighash {}) with redeemscript {}" , log_bytes!( sig. serialize_compact( ) [ ..] ) , log_bytes!( self . their_funding_pubkey( ) . serialize( ) ) , encode:: serialize_hex( & local_initial_commitment_tx) , log_bytes!( local_sighash[ ..] ) , encode:: serialize_hex( & funding_script) ) ;
1456
1455
secp_check ! ( self . secp_ctx. verify( & local_sighash, & sig, self . their_funding_pubkey( ) ) , "Invalid funding_created signature from peer" ) ;
1457
1456
1458
- let localtx = LocalCommitmentTransaction :: new_missing_local_sig ( local_initial_commitment_tx, sig. clone ( ) , & PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . funding_key ( ) ) , self . their_funding_pubkey ( ) , local_keys, self . feerate_per_kw , Vec :: new ( ) ) ;
1457
+ let localtx = LocalCommitmentTransaction :: new_missing_local_sig ( local_initial_commitment_tx, sig. clone ( ) , & self . local_keys . pubkeys ( ) . funding_pubkey , self . their_funding_pubkey ( ) , local_keys, self . feerate_per_kw , Vec :: new ( ) ) ;
1459
1458
1460
1459
let remote_keys = self . build_remote_transaction_keys ( ) ?;
1461
1460
let remote_initial_commitment_tx = self . build_commitment_transaction ( self . cur_remote_commitment_transaction_number , & remote_keys, false , false , self . feerate_per_kw , logger) . 0 ;
@@ -1568,7 +1567,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1568
1567
let funding_txo_script = funding_redeemscript. to_v0_p2wsh ( ) ;
1569
1568
macro_rules! create_monitor {
1570
1569
( ) => { {
1571
- let local_commitment_tx = LocalCommitmentTransaction :: new_missing_local_sig( local_initial_commitment_tx. clone( ) , msg. signature. clone( ) , & PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys. funding_key ( ) ) , their_funding_pubkey, local_keys. clone( ) , self . feerate_per_kw, Vec :: new( ) ) ;
1570
+ let local_commitment_tx = LocalCommitmentTransaction :: new_missing_local_sig( local_initial_commitment_tx. clone( ) , msg. signature. clone( ) , & self . local_keys. pubkeys ( ) . funding_pubkey , their_funding_pubkey, local_keys. clone( ) , self . feerate_per_kw, Vec :: new( ) ) ;
1572
1571
let mut channel_monitor = ChannelMonitor :: new( self . local_keys. clone( ) ,
1573
1572
& self . shutdown_pubkey, self . our_to_self_delay,
1574
1573
& self . destination_script, ( funding_txo. clone( ) , funding_txo_script. clone( ) ) ,
@@ -1899,7 +1898,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1899
1898
let mut monitor_update = ChannelMonitorUpdate {
1900
1899
update_id : self . latest_monitor_update_id ,
1901
1900
updates : vec ! [ ChannelMonitorUpdateStep :: LatestLocalCommitmentTXInfo {
1902
- commitment_tx: LocalCommitmentTransaction :: new_missing_local_sig( local_commitment_tx. 0 , msg. signature. clone( ) , & PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys. funding_key ( ) ) , & their_funding_pubkey, local_keys, self . feerate_per_kw, htlcs_without_source) ,
1901
+ commitment_tx: LocalCommitmentTransaction :: new_missing_local_sig( local_commitment_tx. 0 , msg. signature. clone( ) , & self . local_keys. pubkeys ( ) . funding_pubkey , & their_funding_pubkey, local_keys, self . feerate_per_kw, htlcs_without_source) ,
1903
1902
htlc_outputs: htlcs_and_sigs
1904
1903
} ]
1905
1904
} ;
@@ -2825,7 +2824,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
2825
2824
2826
2825
tx. input [ 0 ] . witness . push ( Vec :: new ( ) ) ; // First is the multisig dummy
2827
2826
2828
- let our_funding_key = PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . funding_key ( ) ) . serialize ( ) ;
2827
+ let our_funding_key = self . local_keys . pubkeys ( ) . funding_pubkey . serialize ( ) ;
2829
2828
let their_funding_key = self . their_funding_pubkey ( ) . serialize ( ) ;
2830
2829
if our_funding_key[ ..] < their_funding_key[ ..] {
2831
2830
tx. input [ 0 ] . witness . push ( our_sig. serialize_der ( ) . to_vec ( ) ) ;
@@ -3315,7 +3314,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
3315
3314
feerate_per_kw : fee_estimator. get_est_sat_per_1000_weight ( ConfirmationTarget :: Background ) as u32 ,
3316
3315
to_self_delay : self . our_to_self_delay ,
3317
3316
max_accepted_htlcs : OUR_MAX_HTLCS ,
3318
- funding_pubkey : PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . funding_key ( ) ) ,
3317
+ funding_pubkey : self . local_keys . pubkeys ( ) . funding_pubkey ,
3319
3318
revocation_basepoint : PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . revocation_base_key ( ) ) ,
3320
3319
payment_point : PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . payment_key ( ) ) ,
3321
3320
delayed_payment_basepoint : PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . delayed_payment_base_key ( ) ) ,
@@ -3348,7 +3347,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
3348
3347
minimum_depth : self . minimum_depth ,
3349
3348
to_self_delay : self . our_to_self_delay ,
3350
3349
max_accepted_htlcs : OUR_MAX_HTLCS ,
3351
- funding_pubkey : PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . funding_key ( ) ) ,
3350
+ funding_pubkey : self . local_keys . pubkeys ( ) . funding_pubkey ,
3352
3351
revocation_basepoint : PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . revocation_base_key ( ) ) ,
3353
3352
payment_point : PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . payment_key ( ) ) ,
3354
3353
delayed_payment_basepoint : PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . delayed_payment_base_key ( ) ) ,
@@ -3431,16 +3430,15 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
3431
3430
}
3432
3431
3433
3432
let were_node_one = our_node_id. serialize ( ) [ ..] < self . their_node_id . serialize ( ) [ ..] ;
3434
- let our_bitcoin_key = PublicKey :: from_secret_key ( & self . secp_ctx , self . local_keys . funding_key ( ) ) ;
3435
3433
3436
3434
let msg = msgs:: UnsignedChannelAnnouncement {
3437
3435
features : ChannelFeatures :: known ( ) ,
3438
3436
chain_hash : chain_hash,
3439
3437
short_channel_id : self . get_short_channel_id ( ) . unwrap ( ) ,
3440
3438
node_id_1 : if were_node_one { our_node_id } else { self . get_their_node_id ( ) } ,
3441
3439
node_id_2 : if were_node_one { self . get_their_node_id ( ) } else { our_node_id } ,
3442
- bitcoin_key_1 : if were_node_one { our_bitcoin_key } else { self . their_funding_pubkey ( ) . clone ( ) } ,
3443
- bitcoin_key_2 : if were_node_one { self . their_funding_pubkey ( ) . clone ( ) } else { our_bitcoin_key } ,
3440
+ bitcoin_key_1 : if were_node_one { self . local_keys . pubkeys ( ) . funding_pubkey } else { self . their_funding_pubkey ( ) . clone ( ) } ,
3441
+ bitcoin_key_2 : if were_node_one { self . their_funding_pubkey ( ) . clone ( ) } else { self . local_keys . pubkeys ( ) . funding_pubkey } ,
3444
3442
excess_data : Vec :: new ( ) ,
3445
3443
} ;
3446
3444
@@ -4442,7 +4440,7 @@ mod tests {
4442
4440
( 0 , 0 )
4443
4441
) ;
4444
4442
4445
- assert_eq ! ( PublicKey :: from_secret_key ( & secp_ctx , chan_keys. funding_key ( ) ) . serialize( ) [ ..] ,
4443
+ assert_eq ! ( chan_keys. pubkeys ( ) . funding_pubkey . serialize( ) [ ..] ,
4446
4444
hex:: decode( "023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb" ) . unwrap( ) [ ..] ) ;
4447
4445
let keys_provider = Keys { chan_keys : chan_keys. clone ( ) } ;
4448
4446
@@ -4512,7 +4510,7 @@ mod tests {
4512
4510
} ) *
4513
4511
assert_eq!( unsigned_tx. 1 . len( ) , per_htlc. len( ) ) ;
4514
4512
4515
- localtx = LocalCommitmentTransaction :: new_missing_local_sig( unsigned_tx. 0 . clone( ) , their_signature. clone( ) , & PublicKey :: from_secret_key ( & secp_ctx , chan . local_keys . funding_key ( ) ) , chan. their_funding_pubkey( ) , keys. clone( ) , chan. feerate_per_kw, per_htlc) ;
4513
+ localtx = LocalCommitmentTransaction :: new_missing_local_sig( unsigned_tx. 0 . clone( ) , their_signature. clone( ) , & chan_keys . pubkeys ( ) . funding_pubkey , chan. their_funding_pubkey( ) , keys. clone( ) , chan. feerate_per_kw, per_htlc) ;
4516
4514
let local_sig = chan_keys. sign_local_commitment( & localtx, & chan. secp_ctx) . unwrap( ) ;
4517
4515
assert_eq!( Signature :: from_der( & hex:: decode( $our_sig_hex) . unwrap( ) [ ..] ) . unwrap( ) , local_sig) ;
4518
4516
0 commit comments