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 @@ -552,6 +552,15 @@ impl ChannelMonitor {
552
552
if our_min_secret > other_min_secret {
553
553
self . provide_secret ( other_min_secret, other. get_secret ( other_min_secret) . unwrap ( ) ) ?;
554
554
}
555
+ if let Some ( ref local_tx) = self . current_local_signed_commitment_tx {
556
+ if let Some ( ref other_local_tx) = other. current_local_signed_commitment_tx {
557
+ 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 ) ;
558
+ 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 ) ;
559
+ if our_commitment_number >= other_commitment_number {
560
+ self . key_storage = other. key_storage ;
561
+ }
562
+ }
563
+ }
555
564
// TODO: We should use current_remote_commitment_number and the commitment number out of
556
565
// local transactions to decide how to merge
557
566
if our_min_secret >= other_min_secret {
@@ -567,6 +576,7 @@ impl ChannelMonitor {
567
576
}
568
577
self . payment_preimages = other. payment_preimages ;
569
578
}
579
+
570
580
self . current_remote_commitment_number = cmp:: min ( self . current_remote_commitment_number , other. current_remote_commitment_number ) ;
571
581
Ok ( ( ) )
572
582
}
You can’t perform that action at this time.
0 commit comments