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