@@ -74,6 +74,8 @@ pub enum SpendableOutputDescriptor {
74
74
/// The output which is referenced by the given outpoint
75
75
output : TxOut ,
76
76
} ,
77
+ // TODO: Note that because key is now static and exactly what is provided by us, we should drop
78
+ // this in favor of StaticOutput:
77
79
/// An output to a P2WPKH, spendable exclusively by the given private key.
78
80
/// The witness in the spending input, is, thus, simply:
79
81
/// <BIP 143 signature generated with the given key> <public key derived from the given key>
@@ -194,9 +196,10 @@ pub trait ChannelKeys : Send+Clone {
194
196
fn funding_key < ' a > ( & ' a self ) -> & ' a SecretKey ;
195
197
/// Gets the local secret key for blinded revocation pubkey
196
198
fn revocation_base_key < ' a > ( & ' a self ) -> & ' a SecretKey ;
197
- /// Gets the local secret key used in to_remote output of remote commitment tx
198
- /// (and also as part of obscured commitment number)
199
- fn payment_base_key < ' a > ( & ' a self ) -> & ' a SecretKey ;
199
+ /// Gets the local secret key used in the to_remote output of remote commitment tx (ie the
200
+ /// output to us in transactions our counterparty broadcasts).
201
+ /// Also as part of obscured commitment number.
202
+ fn payment_key < ' a > ( & ' a self ) -> & ' a SecretKey ;
200
203
/// Gets the local secret key used in HTLC-Success/HTLC-Timeout txn and to_local output
201
204
fn delayed_payment_base_key < ' a > ( & ' a self ) -> & ' a SecretKey ;
202
205
/// Gets the local htlc secret key used in commitment tx htlc outputs
@@ -273,8 +276,8 @@ pub struct InMemoryChannelKeys {
273
276
funding_key : SecretKey ,
274
277
/// Local secret key for blinded revocation pubkey
275
278
revocation_base_key : SecretKey ,
276
- /// Local secret key used in commitment tx htlc outputs
277
- payment_base_key : SecretKey ,
279
+ /// Local secret key used for our balance in remote-broadcasted commitment transactions
280
+ payment_key : SecretKey ,
278
281
/// Local secret key used in HTLC tx
279
282
delayed_payment_base_key : SecretKey ,
280
283
/// Local htlc secret key used in commitment tx htlc outputs
@@ -295,19 +298,19 @@ impl InMemoryChannelKeys {
295
298
secp_ctx : & Secp256k1 < C > ,
296
299
funding_key : SecretKey ,
297
300
revocation_base_key : SecretKey ,
298
- payment_base_key : SecretKey ,
301
+ payment_key : SecretKey ,
299
302
delayed_payment_base_key : SecretKey ,
300
303
htlc_base_key : SecretKey ,
301
304
commitment_seed : [ u8 ; 32 ] ,
302
305
channel_value_satoshis : u64 ) -> InMemoryChannelKeys {
303
306
let local_channel_pubkeys =
304
307
InMemoryChannelKeys :: make_local_keys ( secp_ctx, & funding_key, & revocation_base_key,
305
- & payment_base_key , & delayed_payment_base_key,
308
+ & payment_key , & delayed_payment_base_key,
306
309
& htlc_base_key) ;
307
310
InMemoryChannelKeys {
308
311
funding_key,
309
312
revocation_base_key,
310
- payment_base_key ,
313
+ payment_key ,
311
314
delayed_payment_base_key,
312
315
htlc_base_key,
313
316
commitment_seed,
@@ -320,14 +323,14 @@ impl InMemoryChannelKeys {
320
323
fn make_local_keys < C : Signing > ( secp_ctx : & Secp256k1 < C > ,
321
324
funding_key : & SecretKey ,
322
325
revocation_base_key : & SecretKey ,
323
- payment_base_key : & SecretKey ,
326
+ payment_key : & SecretKey ,
324
327
delayed_payment_base_key : & SecretKey ,
325
328
htlc_base_key : & SecretKey ) -> ChannelPublicKeys {
326
329
let from_secret = |s : & SecretKey | PublicKey :: from_secret_key ( secp_ctx, s) ;
327
330
ChannelPublicKeys {
328
331
funding_pubkey : from_secret ( & funding_key) ,
329
332
revocation_basepoint : from_secret ( & revocation_base_key) ,
330
- payment_basepoint : from_secret ( & payment_base_key ) ,
333
+ payment_point : from_secret ( & payment_key ) ,
331
334
delayed_payment_basepoint : from_secret ( & delayed_payment_base_key) ,
332
335
htlc_basepoint : from_secret ( & htlc_base_key) ,
333
336
}
@@ -337,7 +340,7 @@ impl InMemoryChannelKeys {
337
340
impl ChannelKeys for InMemoryChannelKeys {
338
341
fn funding_key ( & self ) -> & SecretKey { & self . funding_key }
339
342
fn revocation_base_key ( & self ) -> & SecretKey { & self . revocation_base_key }
340
- fn payment_base_key ( & self ) -> & SecretKey { & self . payment_base_key }
343
+ fn payment_key ( & self ) -> & SecretKey { & self . payment_key }
341
344
fn delayed_payment_base_key ( & self ) -> & SecretKey { & self . delayed_payment_base_key }
342
345
fn htlc_base_key ( & self ) -> & SecretKey { & self . htlc_base_key }
343
346
fn commitment_seed ( & self ) -> & [ u8 ; 32 ] { & self . commitment_seed }
@@ -422,7 +425,7 @@ impl Writeable for InMemoryChannelKeys {
422
425
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , Error > {
423
426
self . funding_key . write ( writer) ?;
424
427
self . revocation_base_key . write ( writer) ?;
425
- self . payment_base_key . write ( writer) ?;
428
+ self . payment_key . write ( writer) ?;
426
429
self . delayed_payment_base_key . write ( writer) ?;
427
430
self . htlc_base_key . write ( writer) ?;
428
431
self . commitment_seed . write ( writer) ?;
@@ -437,7 +440,7 @@ impl Readable for InMemoryChannelKeys {
437
440
fn read < R : :: std:: io:: Read > ( reader : & mut R ) -> Result < Self , DecodeError > {
438
441
let funding_key = Readable :: read ( reader) ?;
439
442
let revocation_base_key = Readable :: read ( reader) ?;
440
- let payment_base_key = Readable :: read ( reader) ?;
443
+ let payment_key = Readable :: read ( reader) ?;
441
444
let delayed_payment_base_key = Readable :: read ( reader) ?;
442
445
let htlc_base_key = Readable :: read ( reader) ?;
443
446
let commitment_seed = Readable :: read ( reader) ?;
@@ -446,13 +449,13 @@ impl Readable for InMemoryChannelKeys {
446
449
let secp_ctx = Secp256k1 :: signing_only ( ) ;
447
450
let local_channel_pubkeys =
448
451
InMemoryChannelKeys :: make_local_keys ( & secp_ctx, & funding_key, & revocation_base_key,
449
- & payment_base_key , & delayed_payment_base_key,
452
+ & payment_key , & delayed_payment_base_key,
450
453
& htlc_base_key) ;
451
454
452
455
Ok ( InMemoryChannelKeys {
453
456
funding_key,
454
457
revocation_base_key,
455
- payment_base_key ,
458
+ payment_key ,
456
459
delayed_payment_base_key,
457
460
htlc_base_key,
458
461
commitment_seed,
@@ -598,15 +601,15 @@ impl KeysInterface for KeysManager {
598
601
}
599
602
let funding_key = key_step ! ( b"funding key" , commitment_seed) ;
600
603
let revocation_base_key = key_step ! ( b"revocation base key" , funding_key) ;
601
- let payment_base_key = key_step ! ( b"payment base key" , revocation_base_key) ;
602
- let delayed_payment_base_key = key_step ! ( b"delayed payment base key" , payment_base_key ) ;
604
+ let payment_key = key_step ! ( b"payment key" , revocation_base_key) ;
605
+ let delayed_payment_base_key = key_step ! ( b"delayed payment base key" , payment_key ) ;
603
606
let htlc_base_key = key_step ! ( b"HTLC base key" , delayed_payment_base_key) ;
604
607
605
608
InMemoryChannelKeys :: new (
606
609
& self . secp_ctx ,
607
610
funding_key,
608
611
revocation_base_key,
609
- payment_base_key ,
612
+ payment_key ,
610
613
delayed_payment_base_key,
611
614
htlc_base_key,
612
615
commitment_seed,
0 commit comments