File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -548,6 +548,15 @@ impl ChannelMonitor {
548
548
if our_min_secret > other_min_secret {
549
549
self . provide_secret ( other_min_secret, other. get_secret ( other_min_secret) . unwrap ( ) ) ?;
550
550
}
551
+ if let Some ( ref local_tx) = self . current_local_signed_commitment_tx {
552
+ if let Some ( ref other_local_tx) = other. current_local_signed_commitment_tx {
553
+ let our_commitment_number = 0xffffffffffff - ( ( ( ( local_tx. tx . input [ 0 ] . sequence as u64 & 0xffffff ) << 3 * 8 ) | ( local_tx. tx . lock_time as u64 & 0xffffff ) ) ^ self . commitment_transaction_number_obscure_factor ) ;
554
+ let other_commitment_number = 0xffffffffffff - ( ( ( ( other_local_tx. tx . input [ 0 ] . sequence as u64 & 0xffffff ) << 3 * 8 ) | ( other_local_tx. tx . lock_time as u64 & 0xffffff ) ) ^ other. commitment_transaction_number_obscure_factor ) ;
555
+ if our_commitment_number >= other_commitment_number {
556
+ self . key_storage = other. key_storage ;
557
+ }
558
+ }
559
+ }
551
560
// TODO: We should use current_remote_commitment_number and the commitment number out of
552
561
// local transactions to decide how to merge
553
562
if our_min_secret >= other_min_secret {
@@ -563,6 +572,7 @@ impl ChannelMonitor {
563
572
}
564
573
self . payment_preimages = other. payment_preimages ;
565
574
}
575
+
566
576
self . current_remote_commitment_number = cmp:: min ( self . current_remote_commitment_number , other. current_remote_commitment_number ) ;
567
577
Ok ( ( ) )
568
578
}
You can’t perform that action at this time.
0 commit comments