@@ -219,52 +219,52 @@ pub trait ChannelKeys : Send+Clone {
219219 /// Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
220220 /// TODO: return a Result so we can signal a validation error
221221 fn release_commitment_secret ( & self , idx : u64 ) -> [ u8 ; 32 ] ;
222- /// Gets the local channel public keys and basepoints
222+ /// Gets the holder's channel public keys and basepoints
223223 fn pubkeys ( & self ) -> & ChannelPublicKeys ;
224224 /// Gets arbitrary identifiers describing the set of keys which are provided back to you in
225225 /// some SpendableOutputDescriptor types. These should be sufficient to identify this
226226 /// ChannelKeys object uniquely and lookup or re-derive its keys.
227227 fn key_derivation_params ( & self ) -> ( u64 , u64 ) ;
228228
229- /// Create a signature for a remote commitment transaction and associated HTLC transactions.
229+ /// Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
230230 ///
231231 /// Note that if signing fails or is rejected, the channel will be force-closed.
232232 //
233233 // TODO: Document the things someone using this interface should enforce before signing.
234234 // TODO: Add more input vars to enable better checking (preferably removing commitment_tx and
235235 // making the callee generate it via some util function we expose)!
236- fn sign_remote_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , feerate_per_kw : u32 , commitment_tx : & Transaction , keys : & PreCalculatedTxCreationKeys , htlcs : & [ & HTLCOutputInCommitment ] , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > ;
236+ fn sign_counterparty_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , feerate_per_kw : u32 , commitment_tx : & Transaction , keys : & PreCalculatedTxCreationKeys , htlcs : & [ & HTLCOutputInCommitment ] , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > ;
237237
238- /// Create a signature for a local commitment transaction. This will only ever be called with
239- /// the same local_commitment_tx (or a copy thereof), though there are currently no guarantees
238+ /// Create a signature for a holder's commitment transaction. This will only ever be called with
239+ /// the same holder_commitment_tx (or a copy thereof), though there are currently no guarantees
240240 /// that it will not be called multiple times.
241241 /// An external signer implementation should check that the commitment has not been revoked.
242242 //
243243 // TODO: Document the things someone using this interface should enforce before signing.
244244 // TODO: Add more input vars to enable better checking (preferably removing commitment_tx and
245- fn sign_local_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , local_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > ;
245+ fn sign_holder_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , holder_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > ;
246246
247- /// Same as sign_local_commitment , but exists only for tests to get access to local commitment
247+ /// Same as sign_holder_commitment , but exists only for tests to get access to holder commitment
248248 /// transactions which will be broadcasted later, after the channel has moved on to a newer
249- /// state. Thus, needs its own method as sign_local_commitment may enforce that we only ever
249+ /// state. Thus, needs its own method as sign_holder_commitment may enforce that we only ever
250250 /// get called once.
251251 #[ cfg( any( test, feature = "unsafe_revoked_tx_signing" ) ) ]
252- fn unsafe_sign_local_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , local_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > ;
252+ fn unsafe_sign_holder_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , holder_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > ;
253253
254- /// Create a signature for each HTLC transaction spending a local commitment transaction.
254+ /// Create a signature for each HTLC transaction spending a holder's commitment transaction.
255255 ///
256- /// Unlike sign_local_commitment , this may be called multiple times with *different*
257- /// local_commitment_tx values. While this will never be called with a revoked
258- /// local_commitment_tx , it is possible that it is called with the second-latest
259- /// local_commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
256+ /// Unlike sign_holder_commitment , this may be called multiple times with *different*
257+ /// holder_commitment_tx values. While this will never be called with a revoked
258+ /// holder_commitment_tx , it is possible that it is called with the second-latest
259+ /// holder_commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
260260 /// ChannelMonitor decided to broadcast before it had been updated to the latest.
261261 ///
262262 /// Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
263- /// local_commitment_tx . For those HTLCs which have transaction_output_index set to None
263+ /// holder_commitment_tx . For those HTLCs which have transaction_output_index set to None
264264 /// (implying they were considered dust at the time the commitment transaction was negotiated),
265265 /// a corresponding None should be included in the return value. All other positions in the
266266 /// return value must contain a signature.
267- fn sign_local_commitment_htlc_transactions < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , local_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Vec < Option < Signature > > , ( ) > ;
267+ fn sign_holder_commitment_htlc_transactions < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , holder_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Vec < Option < Signature > > , ( ) > ;
268268
269269 /// Create a signature for the given input in a transaction spending an HTLC or commitment
270270 /// transaction output when our counterparty broadcasts an old state.
@@ -277,16 +277,16 @@ pub trait ChannelKeys : Send+Clone {
277277 /// Amount is value of the output spent by this input, committed to in the BIP 143 signature.
278278 ///
279279 /// per_commitment_key is revocation secret which was provided by our counterparty when they
280- /// revoked the state which they eventually broadcast. It's not a _local_ secret key and does
281- /// not allow the spending of any funds by itself (you need our local revocation_secret to do
280+ /// revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
281+ /// not allow the spending of any funds by itself (you need our holder revocation_secret to do
282282 /// so).
283283 ///
284284 /// htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
285285 /// changing the format of the witness script (which is committed to in the BIP 143
286286 /// signatures).
287287 fn sign_justice_transaction < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , htlc : & Option < HTLCOutputInCommitment > , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > ;
288288
289- /// Create a signature for a claiming transaction for a HTLC output on a remote commitment
289+ /// Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
290290 /// transaction, either offered or received.
291291 ///
292292 /// Such a transaction may claim multiples offered outputs at same time if we know the
@@ -303,7 +303,7 @@ pub trait ChannelKeys : Send+Clone {
303303 /// detected onchain. It has been generated by our counterparty and is used to derive
304304 /// channel state keys, which are then included in the witness script and committed to in the
305305 /// BIP 143 signature.
306- 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 , ( ) > ;
306+ fn sign_counterparty_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 , ( ) > ;
307307
308308 /// Create a signature for a (proposed) closing transaction.
309309 ///
@@ -359,7 +359,7 @@ struct AcceptedChannelData {
359359 /// The contest_delay value specified by our counterparty and applied on locally-broadcastable
360360 /// transactions, ie the amount of time that we have to wait to recover our funds if we
361361 /// broadcast a transaction. You'll likely want to pass this to the
362- /// ln::chan_utils::build*_transaction functions when signing local transactions.
362+ /// ln::chan_utils::build*_transaction functions when signing holder's transactions.
363363 counterparty_selected_contest_delay : u16 ,
364364 /// The contest_delay value specified by us and applied on transactions broadcastable
365365 /// by our counterparty, ie the amount of time that they have to wait to recover their funds
@@ -372,18 +372,18 @@ struct AcceptedChannelData {
372372pub struct InMemoryChannelKeys {
373373 /// Private key of anchor tx
374374 pub funding_key : SecretKey ,
375- /// Local secret key for blinded revocation pubkey
375+ /// Holder secret key for blinded revocation pubkey
376376 pub revocation_base_key : SecretKey ,
377- /// Local secret key used for our balance in remote -broadcasted commitment transactions
377+ /// Holder secret key used for our balance in counterparty -broadcasted commitment transactions
378378 pub payment_key : SecretKey ,
379- /// Local secret key used in HTLC tx
379+ /// Holder secret key used in HTLC tx
380380 pub delayed_payment_base_key : SecretKey ,
381- /// Local htlc secret key used in commitment tx htlc outputs
381+ /// Holder htlc secret key used in commitment tx htlc outputs
382382 pub htlc_base_key : SecretKey ,
383383 /// Commitment seed
384384 pub commitment_seed : [ u8 ; 32 ] ,
385- /// Local public keys and basepoints
386- pub ( crate ) local_channel_pubkeys : ChannelPublicKeys ,
385+ /// Holder public keys and basepoints
386+ pub ( crate ) holder_channel_pubkeys : ChannelPublicKeys ,
387387 /// Counterparty public keys and counterparty/locally selected_contest_delay, populated on channel acceptance
388388 accepted_channel_data : Option < AcceptedChannelData > ,
389389 /// The total value of this channel
@@ -404,8 +404,8 @@ impl InMemoryChannelKeys {
404404 commitment_seed : [ u8 ; 32 ] ,
405405 channel_value_satoshis : u64 ,
406406 key_derivation_params : ( u64 , u64 ) ) -> InMemoryChannelKeys {
407- let local_channel_pubkeys =
408- InMemoryChannelKeys :: make_local_keys ( secp_ctx, & funding_key, & revocation_base_key,
407+ let holder_channel_pubkeys =
408+ InMemoryChannelKeys :: make_holder_keys ( secp_ctx, & funding_key, & revocation_base_key,
409409 & payment_key, & delayed_payment_base_key,
410410 & htlc_base_key) ;
411411 InMemoryChannelKeys {
@@ -416,13 +416,13 @@ impl InMemoryChannelKeys {
416416 htlc_base_key,
417417 commitment_seed,
418418 channel_value_satoshis,
419- local_channel_pubkeys ,
419+ holder_channel_pubkeys ,
420420 accepted_channel_data : None ,
421421 key_derivation_params,
422422 }
423423 }
424424
425- fn make_local_keys < C : Signing > ( secp_ctx : & Secp256k1 < C > ,
425+ fn make_holder_keys < C : Signing > ( secp_ctx : & Secp256k1 < C > ,
426426 funding_key : & SecretKey ,
427427 revocation_base_key : & SecretKey ,
428428 payment_key : & SecretKey ,
@@ -445,7 +445,7 @@ impl InMemoryChannelKeys {
445445 /// The contest_delay value specified by our counterparty and applied on locally-broadcastable
446446 /// transactions, ie the amount of time that we have to wait to recover our funds if we
447447 /// broadcast a transaction. You'll likely want to pass this to the
448- /// ln::chan_utils::build*_transaction functions when signing local transactions.
448+ /// ln::chan_utils::build*_transaction functions when signing holder's transactions.
449449 /// Will panic if on_accept wasn't called.
450450 pub fn counterparty_selected_contest_delay ( & self ) -> u16 { self . accepted_channel_data . as_ref ( ) . unwrap ( ) . counterparty_selected_contest_delay }
451451
@@ -466,10 +466,10 @@ impl ChannelKeys for InMemoryChannelKeys {
466466 chan_utils:: build_commitment_secret ( & self . commitment_seed , idx)
467467 }
468468
469- fn pubkeys ( & self ) -> & ChannelPublicKeys { & self . local_channel_pubkeys }
469+ fn pubkeys ( & self ) -> & ChannelPublicKeys { & self . holder_channel_pubkeys }
470470 fn key_derivation_params ( & self ) -> ( u64 , u64 ) { self . key_derivation_params }
471471
472- fn sign_remote_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , feerate_per_kw : u32 , commitment_tx : & Transaction , pre_keys : & PreCalculatedTxCreationKeys , htlcs : & [ & HTLCOutputInCommitment ] , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > {
472+ fn sign_counterparty_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , feerate_per_kw : u32 , commitment_tx : & Transaction , pre_keys : & PreCalculatedTxCreationKeys , htlcs : & [ & HTLCOutputInCommitment ] , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > {
473473 if commitment_tx. input . len ( ) != 1 { return Err ( ( ) ) ; }
474474 let keys = pre_keys. trust_key_derivation ( ) ;
475475
@@ -499,26 +499,26 @@ impl ChannelKeys for InMemoryChannelKeys {
499499 Ok ( ( commitment_sig, htlc_sigs) )
500500 }
501501
502- fn sign_local_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , local_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
502+ fn sign_holder_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , holder_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
503503 let funding_pubkey = PublicKey :: from_secret_key ( secp_ctx, & self . funding_key ) ;
504504 let counterparty_channel_data = self . accepted_channel_data . as_ref ( ) . expect ( "must accept before signing" ) ;
505505 let channel_funding_redeemscript = make_funding_redeemscript ( & funding_pubkey, & counterparty_channel_data. counterparty_channel_pubkeys . funding_pubkey ) ;
506506
507- Ok ( local_commitment_tx . get_local_sig ( & self . funding_key , & channel_funding_redeemscript, self . channel_value_satoshis , secp_ctx) )
507+ Ok ( holder_commitment_tx . get_local_sig ( & self . funding_key , & channel_funding_redeemscript, self . channel_value_satoshis , secp_ctx) )
508508 }
509509
510510 #[ cfg( any( test, feature = "unsafe_revoked_tx_signing" ) ) ]
511- fn unsafe_sign_local_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , local_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
511+ fn unsafe_sign_holder_commitment < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , holder_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
512512 let funding_pubkey = PublicKey :: from_secret_key ( secp_ctx, & self . funding_key ) ;
513513 let counterparty_channel_pubkeys = & self . accepted_channel_data . as_ref ( ) . expect ( "must accept before signing" ) . counterparty_channel_pubkeys ;
514514 let channel_funding_redeemscript = make_funding_redeemscript ( & funding_pubkey, & counterparty_channel_pubkeys. funding_pubkey ) ;
515515
516- Ok ( local_commitment_tx . get_local_sig ( & self . funding_key , & channel_funding_redeemscript, self . channel_value_satoshis , secp_ctx) )
516+ Ok ( holder_commitment_tx . get_local_sig ( & self . funding_key , & channel_funding_redeemscript, self . channel_value_satoshis , secp_ctx) )
517517 }
518518
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 ( ) . counterparty_selected_contest_delay ;
521- local_commitment_tx . get_htlc_sigs ( & self . htlc_base_key , local_csv , secp_ctx)
519+ fn sign_holder_commitment_htlc_transactions < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , holder_commitment_tx : & LocalCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < Vec < Option < Signature > > , ( ) > {
520+ let counterparty_selected_contest_delay = self . accepted_channel_data . as_ref ( ) . unwrap ( ) . counterparty_selected_contest_delay ;
521+ holder_commitment_tx . get_htlc_sigs ( & self . htlc_base_key , counterparty_selected_contest_delay , secp_ctx)
522522 }
523523
524524 fn sign_justice_transaction < T : secp256k1:: Signing + secp256k1:: Verification > ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , htlc : & Option < HTLCOutputInCommitment > , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
@@ -536,11 +536,11 @@ impl ChannelKeys for InMemoryChannelKeys {
536536 Ok ( counterparty_htlcpubkey) => counterparty_htlcpubkey,
537537 Err ( _) => return Err ( ( ) )
538538 } ;
539- let local_htlcpubkey = match chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . pubkeys ( ) . htlc_basepoint ) {
540- Ok ( local_htlcpubkey ) => local_htlcpubkey ,
539+ let holder_htlcpubkey = match chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . pubkeys ( ) . htlc_basepoint ) {
540+ Ok ( holder_htlcpubkey ) => holder_htlcpubkey ,
541541 Err ( _) => return Err ( ( ) )
542542 } ;
543- chan_utils:: get_htlc_redeemscript_with_explicit_keys ( & htlc, & counterparty_htlcpubkey, & local_htlcpubkey , & revocation_pubkey)
543+ chan_utils:: get_htlc_redeemscript_with_explicit_keys ( & htlc, & counterparty_htlcpubkey, & holder_htlcpubkey , & revocation_pubkey)
544544 } else {
545545 let counterparty_delayedpubkey = match chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . counterparty_pubkeys ( ) . delayed_payment_basepoint ) {
546546 Ok ( counterparty_delayedpubkey) => counterparty_delayedpubkey,
@@ -553,7 +553,7 @@ impl ChannelKeys for InMemoryChannelKeys {
553553 return Ok ( secp_ctx. sign ( & sighash, & revocation_key) )
554554 }
555555
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 , ( ) > {
556+ fn sign_counterparty_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 , ( ) > {
557557 if let Ok ( htlc_key) = chan_utils:: derive_private_key ( & secp_ctx, & per_commitment_point, & self . htlc_base_key ) {
558558 let witness_script = if let Ok ( revocation_pubkey) = chan_utils:: derive_public_revocation_key ( & secp_ctx, & per_commitment_point, & self . pubkeys ( ) . revocation_basepoint ) {
559559 if let Ok ( counterparty_htlcpubkey) = chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . counterparty_pubkeys ( ) . htlc_basepoint ) {
@@ -629,8 +629,8 @@ impl Readable for InMemoryChannelKeys {
629629 let counterparty_channel_data = Readable :: read ( reader) ?;
630630 let channel_value_satoshis = Readable :: read ( reader) ?;
631631 let secp_ctx = Secp256k1 :: signing_only ( ) ;
632- let local_channel_pubkeys =
633- InMemoryChannelKeys :: make_local_keys ( & secp_ctx, & funding_key, & revocation_base_key,
632+ let holder_channel_pubkeys =
633+ InMemoryChannelKeys :: make_holder_keys ( & secp_ctx, & funding_key, & revocation_base_key,
634634 & payment_key, & delayed_payment_base_key,
635635 & htlc_base_key) ;
636636 let params_1 = Readable :: read ( reader) ?;
@@ -644,7 +644,7 @@ impl Readable for InMemoryChannelKeys {
644644 htlc_base_key,
645645 commitment_seed,
646646 channel_value_satoshis,
647- local_channel_pubkeys ,
647+ holder_channel_pubkeys ,
648648 accepted_channel_data : counterparty_channel_data,
649649 key_derivation_params : ( params_1, params_2) ,
650650 } )
0 commit comments