File tree 1 file changed +22
-0
lines changed
lightning-liquidity/src/lsps2
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -435,6 +435,18 @@ impl OutboundJITChannel {
435
435
self . state = new_state;
436
436
Ok ( action)
437
437
}
438
+
439
+ fn is_prunable ( & self ) -> bool {
440
+ // We deem an OutboundJITChannel prunable if our offer expired and we haven't intercepted
441
+ // any HTLCs initiating the flow yet.
442
+ let is_pending_initial_payment = match self . state {
443
+ OutboundJITChannelState :: PendingInitialPayment { .. } => true ,
444
+ _ => false ,
445
+ } ;
446
+
447
+ let is_expired = is_expired_opening_fee_params ( & self . opening_fee_params ) ;
448
+ is_pending_initial_payment && is_expired
449
+ }
438
450
}
439
451
440
452
struct PeerState {
@@ -472,6 +484,16 @@ impl PeerState {
472
484
} ,
473
485
}
474
486
} ) ;
487
+
488
+ self . outbound_channels_by_intercept_scid . retain ( |intercept_scid, entry| {
489
+ if entry. is_prunable ( ) {
490
+ // We abort the flow, and prune any data kept.
491
+ self . intercept_scid_by_channel_id . retain ( |_, iscid| intercept_scid != iscid) ;
492
+ self . intercept_scid_by_user_channel_id . retain ( |_, iscid| intercept_scid != iscid) ;
493
+ return false ;
494
+ }
495
+ true
496
+ } ) ;
475
497
}
476
498
}
477
499
You can’t perform that action at this time.
0 commit comments