@@ -166,6 +166,7 @@ pub struct ChannelMonitor {
166
166
key_storage : KeyStorage ,
167
167
delayed_payment_base_key : PublicKey ,
168
168
their_htlc_base_key : Option < PublicKey > ,
169
+ their_delayed_payment_base_key : Option < PublicKey > ,
169
170
// first is the idx of the first of the two revocation points
170
171
their_cur_revocation_points : Option < ( u64 , PublicKey , Option < PublicKey > ) > ,
171
172
@@ -207,6 +208,7 @@ impl Clone for ChannelMonitor {
207
208
key_storage : self . key_storage . clone ( ) ,
208
209
delayed_payment_base_key : self . delayed_payment_base_key . clone ( ) ,
209
210
their_htlc_base_key : self . their_htlc_base_key . clone ( ) ,
211
+ their_delayed_payment_base_key : self . their_delayed_payment_base_key . clone ( ) ,
210
212
their_cur_revocation_points : self . their_cur_revocation_points . clone ( ) ,
211
213
212
214
our_to_self_delay : self . our_to_self_delay ,
@@ -238,6 +240,7 @@ impl PartialEq for ChannelMonitor {
238
240
self . key_storage != other. key_storage ||
239
241
self . delayed_payment_base_key != other. delayed_payment_base_key ||
240
242
self . their_htlc_base_key != other. their_htlc_base_key ||
243
+ self . their_delayed_payment_base_key != other. their_delayed_payment_base_key ||
241
244
self . their_cur_revocation_points != other. their_cur_revocation_points ||
242
245
self . our_to_self_delay != other. our_to_self_delay ||
243
246
self . their_to_self_delay != other. their_to_self_delay ||
@@ -274,6 +277,7 @@ impl ChannelMonitor {
274
277
} ,
275
278
delayed_payment_base_key : delayed_payment_base_key. clone ( ) ,
276
279
their_htlc_base_key : None ,
280
+ their_delayed_payment_base_key : None ,
277
281
their_cur_revocation_points : None ,
278
282
279
283
our_to_self_delay : our_to_self_delay,
@@ -478,8 +482,10 @@ impl ChannelMonitor {
478
482
self . funding_txo = Some ( funding_info) ;
479
483
}
480
484
481
- pub ( super ) fn set_their_htlc_base_key ( & mut self , their_htlc_base_key : & PublicKey ) {
485
+ /// We log these base keys at channel opening to being able to rebuild redeemscript in case of leaked revoked commit tx
486
+ pub ( super ) fn set_their_base_keys ( & mut self , their_htlc_base_key : & PublicKey , their_delayed_payment_base_key : & PublicKey ) {
482
487
self . their_htlc_base_key = Some ( their_htlc_base_key. clone ( ) ) ;
488
+ self . their_delayed_payment_base_key = Some ( their_delayed_payment_base_key. clone ( ) ) ;
483
489
}
484
490
485
491
pub ( super ) fn set_their_to_self_delay ( & mut self , their_to_self_delay : u16 ) {
@@ -531,6 +537,7 @@ impl ChannelMonitor {
531
537
532
538
res. extend_from_slice ( & self . delayed_payment_base_key . serialize ( ) ) ;
533
539
res. extend_from_slice ( & self . their_htlc_base_key . as_ref ( ) . unwrap ( ) . serialize ( ) ) ;
540
+ res. extend_from_slice ( & self . their_delayed_payment_base_key . as_ref ( ) . unwrap ( ) . serialize ( ) ) ;
534
541
535
542
match self . their_cur_revocation_points {
536
543
Some ( ( idx, pubkey, second_option) ) => {
@@ -705,6 +712,7 @@ impl ChannelMonitor {
705
712
706
713
let delayed_payment_base_key = unwrap_obj ! ( PublicKey :: from_slice( & secp_ctx, read_bytes!( 33 ) ) ) ;
707
714
let their_htlc_base_key = Some ( unwrap_obj ! ( PublicKey :: from_slice( & secp_ctx, read_bytes!( 33 ) ) ) ) ;
715
+ let their_delayed_payment_base_key = Some ( unwrap_obj ! ( PublicKey :: from_slice( & secp_ctx, read_bytes!( 33 ) ) ) ) ;
708
716
709
717
let their_cur_revocation_points = {
710
718
let first_idx = byte_utils:: slice_to_be48 ( read_bytes ! ( 6 ) ) ;
@@ -867,6 +875,7 @@ impl ChannelMonitor {
867
875
key_storage,
868
876
delayed_payment_base_key,
869
877
their_htlc_base_key,
878
+ their_delayed_payment_base_key,
870
879
their_cur_revocation_points,
871
880
872
881
our_to_self_delay,
0 commit comments