@@ -318,13 +318,13 @@ pub trait ChannelKeys : Send+Clone {
318
318
/// protocol.
319
319
fn sign_channel_announcement < T : secp256k1:: Signing > ( & self , msg : & msgs:: UnsignedChannelAnnouncement , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > ;
320
320
321
- /// Set the remote channel basepoints and remote/local to_self_delay.
321
+ /// Set the remote channel basepoints and counterparty/our to_self_delay.
322
322
/// This is done immediately on incoming channels and as soon as the channel is accepted on outgoing channels.
323
323
///
324
- /// We bind local_to_self_delay late here for API convenience.
324
+ /// We bind to_self_delay late here for API convenience.
325
325
///
326
326
/// Will be called before any signatures are applied.
327
- fn on_accept ( & mut self , channel_points : & ChannelPublicKeys , remote_to_self_delay : u16 , local_to_self_delay : u16 ) ;
327
+ fn on_accept ( & mut self , channel_points : & ChannelPublicKeys , counterparty_to_self_delay : u16 , to_self_delay : u16 ) ;
328
328
}
329
329
330
330
/// A trait to describe an object which can get user secrets and key material.
@@ -361,11 +361,11 @@ struct AcceptedChannelData {
361
361
/// transactions, ie the amount of time that we have to wait to recover our funds if we
362
362
/// broadcast a transaction. You'll likely want to pass this to the
363
363
/// ln::chan_utils::build*_transaction functions when signing local transactions.
364
- remote_to_self_delay : u16 ,
364
+ counterparty_to_self_delay : u16 ,
365
365
/// The to_self_delay value specified by us and applied on transactions broadcastable
366
366
/// by our counterparty, ie the amount of time that they have to wait to recover their funds
367
367
/// if they broadcast a transaction.
368
- local_to_self_delay : u16 ,
368
+ to_self_delay : u16 ,
369
369
}
370
370
371
371
#[ derive( Clone ) ]
@@ -448,13 +448,13 @@ impl InMemoryChannelKeys {
448
448
/// broadcast a transaction. You'll likely want to pass this to the
449
449
/// ln::chan_utils::build*_transaction functions when signing local transactions.
450
450
/// Will panic if on_accept wasn't called.
451
- pub fn remote_to_self_delay ( & self ) -> u16 { self . accepted_channel_data . as_ref ( ) . unwrap ( ) . remote_to_self_delay }
451
+ pub fn counterparty_to_self_delay ( & self ) -> u16 { self . accepted_channel_data . as_ref ( ) . unwrap ( ) . counterparty_to_self_delay }
452
452
453
453
/// The to_self_delay value specified by us and applied on transactions broadcastable
454
454
/// by our counterparty, ie the amount of time that they have to wait to recover their funds
455
455
/// if they broadcast a transaction.
456
456
/// Will panic if on_accept wasn't called.
457
- pub fn local_to_self_delay ( & self ) -> u16 { self . accepted_channel_data . as_ref ( ) . unwrap ( ) . local_to_self_delay }
457
+ pub fn to_self_delay ( & self ) -> u16 { self . accepted_channel_data . as_ref ( ) . unwrap ( ) . to_self_delay }
458
458
}
459
459
460
460
impl ChannelKeys for InMemoryChannelKeys {
@@ -486,7 +486,7 @@ impl ChannelKeys for InMemoryChannelKeys {
486
486
let mut htlc_sigs = Vec :: with_capacity ( htlcs. len ( ) ) ;
487
487
for ref htlc in htlcs {
488
488
if let Some ( _) = htlc. transaction_output_index {
489
- let htlc_tx = chan_utils:: build_htlc_transaction ( & commitment_txid, feerate_per_kw, accepted_data. local_to_self_delay , htlc, & keys. a_delayed_payment_key , & keys. revocation_key ) ;
489
+ let htlc_tx = chan_utils:: build_htlc_transaction ( & commitment_txid, feerate_per_kw, accepted_data. to_self_delay , htlc, & keys. delayed_payment_key , & keys. revocation_key ) ;
490
490
let htlc_redeemscript = chan_utils:: get_htlc_redeemscript ( & htlc, & keys) ;
491
491
let htlc_sighash = hash_to_message ! ( & bip143:: SighashComponents :: new( & htlc_tx) . sighash_all( & htlc_tx. input[ 0 ] , & htlc_redeemscript, htlc. amount_msat / 1000 ) [ ..] ) ;
492
492
let our_htlc_key = match chan_utils:: derive_private_key ( & secp_ctx, & keys. per_commitment_point , & self . htlc_base_key ) {
@@ -518,7 +518,7 @@ impl ChannelKeys for InMemoryChannelKeys {
518
518
}
519
519
520
520
fn sign_local_commitment_htlc_transactions < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , local_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Vec < Option < Signature > > , ( ) > {
521
- let local_csv = self . accepted_channel_data . as_ref ( ) . unwrap ( ) . remote_to_self_delay ;
521
+ let local_csv = self . accepted_channel_data . as_ref ( ) . unwrap ( ) . counterparty_to_self_delay ;
522
522
local_commitment_tx. get_htlc_sigs ( & self . htlc_base_key , local_csv, secp_ctx)
523
523
}
524
524
@@ -533,21 +533,21 @@ impl ChannelKeys for InMemoryChannelKeys {
533
533
Err ( _) => return Err ( ( ) )
534
534
} ;
535
535
let witness_script = if let & Some ( ref htlc) = htlc {
536
- let remote_htlcpubkey = match chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . remote_pubkeys ( ) . htlc_basepoint ) {
537
- Ok ( remote_htlcpubkey ) => remote_htlcpubkey ,
536
+ let counterparty_htlcpubkey = match chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . remote_pubkeys ( ) . htlc_basepoint ) {
537
+ Ok ( counterparty_htlcpubkey ) => counterparty_htlcpubkey ,
538
538
Err ( _) => return Err ( ( ) )
539
539
} ;
540
- let local_htlcpubkey = match chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . pubkeys ( ) . htlc_basepoint ) {
541
- Ok ( local_htlcpubkey ) => local_htlcpubkey ,
540
+ let htlcpubkey = match chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . pubkeys ( ) . htlc_basepoint ) {
541
+ Ok ( htlcpubkey ) => htlcpubkey ,
542
542
Err ( _) => return Err ( ( ) )
543
543
} ;
544
- chan_utils:: get_htlc_redeemscript_with_explicit_keys ( & htlc, & remote_htlcpubkey , & local_htlcpubkey , & revocation_pubkey)
544
+ chan_utils:: get_htlc_redeemscript_with_explicit_keys ( & htlc, & counterparty_htlcpubkey , & htlcpubkey , & revocation_pubkey)
545
545
} else {
546
- let remote_delayedpubkey = match chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . remote_pubkeys ( ) . delayed_payment_basepoint ) {
547
- Ok ( remote_delayedpubkey ) => remote_delayedpubkey ,
546
+ let counterparty_delayedpubkey = match chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . remote_pubkeys ( ) . delayed_payment_basepoint ) {
547
+ Ok ( counterparty_delayedpubkey ) => counterparty_delayedpubkey ,
548
548
Err ( _) => return Err ( ( ) )
549
549
} ;
550
- chan_utils:: get_revokeable_redeemscript ( & revocation_pubkey, self . local_to_self_delay ( ) , & remote_delayedpubkey )
550
+ chan_utils:: get_revokeable_redeemscript ( & revocation_pubkey, self . to_self_delay ( ) , & counterparty_delayedpubkey )
551
551
} ;
552
552
let sighash_parts = bip143:: SighashComponents :: new ( & justice_tx) ;
553
553
let sighash = hash_to_message ! ( & sighash_parts. sighash_all( & justice_tx. input[ input] , & witness_script, amount) [ ..] ) ;
@@ -557,9 +557,9 @@ impl ChannelKeys for InMemoryChannelKeys {
557
557
fn sign_remote_htlc_transaction < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , htlc_tx : & Transaction , input : usize , amount : u64 , per_commitment_point : & PublicKey , htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
558
558
if let Ok ( htlc_key) = chan_utils:: derive_private_key ( & secp_ctx, & per_commitment_point, & self . htlc_base_key ) {
559
559
let witness_script = if let Ok ( revocation_pubkey) = chan_utils:: derive_public_revocation_key ( & secp_ctx, & per_commitment_point, & self . pubkeys ( ) . revocation_basepoint ) {
560
- if let Ok ( remote_htlcpubkey ) = chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . remote_pubkeys ( ) . htlc_basepoint ) {
561
- if let Ok ( local_htlcpubkey ) = chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . pubkeys ( ) . htlc_basepoint ) {
562
- chan_utils:: get_htlc_redeemscript_with_explicit_keys ( & htlc, & remote_htlcpubkey , & local_htlcpubkey , & revocation_pubkey)
560
+ if let Ok ( counterparty_htlcpubkey ) = chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . remote_pubkeys ( ) . htlc_basepoint ) {
561
+ if let Ok ( htlcpubkey ) = chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . pubkeys ( ) . htlc_basepoint ) {
562
+ chan_utils:: get_htlc_redeemscript_with_explicit_keys ( & htlc, & counterparty_htlcpubkey , & htlcpubkey , & revocation_pubkey)
563
563
} else { return Err ( ( ) ) }
564
564
} else { return Err ( ( ) ) }
565
565
} else { return Err ( ( ) ) } ;
@@ -589,18 +589,18 @@ impl ChannelKeys for InMemoryChannelKeys {
589
589
Ok ( secp_ctx. sign ( & msghash, & self . funding_key ) )
590
590
}
591
591
592
- fn on_accept ( & mut self , channel_pubkeys : & ChannelPublicKeys , remote_to_self_delay : u16 , local_to_self_delay : u16 ) {
592
+ fn on_accept ( & mut self , channel_pubkeys : & ChannelPublicKeys , counterparty_to_self_delay : u16 , to_self_delay : u16 ) {
593
593
assert ! ( self . accepted_channel_data. is_none( ) , "Already accepted" ) ;
594
594
self . accepted_channel_data = Some ( AcceptedChannelData {
595
595
remote_channel_pubkeys : channel_pubkeys. clone ( ) ,
596
- remote_to_self_delay ,
597
- local_to_self_delay ,
596
+ counterparty_to_self_delay ,
597
+ to_self_delay ,
598
598
} ) ;
599
599
}
600
600
}
601
601
602
602
impl_writeable ! ( AcceptedChannelData , 0 ,
603
- { remote_channel_pubkeys, remote_to_self_delay , local_to_self_delay } ) ;
603
+ { remote_channel_pubkeys, counterparty_to_self_delay , to_self_delay } ) ;
604
604
605
605
impl Writeable for InMemoryChannelKeys {
606
606
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , Error > {
0 commit comments