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 @@ -451,6 +451,18 @@ impl OutboundJITChannel {
451
451
self . state = new_state;
452
452
Ok ( action)
453
453
}
454
+
455
+ fn is_prunable ( & self ) -> bool {
456
+ // We deem an OutboundJITChannel prunable if our offer expired and we haven't intercepted
457
+ // any HTLCs initiating the flow yet.
458
+ let is_pending_initial_payment = match self . state {
459
+ OutboundJITChannelState :: PendingInitialPayment { .. } => true ,
460
+ _ => false ,
461
+ } ;
462
+
463
+ let is_expired = is_expired_opening_fee_params ( & self . opening_fee_params ) ;
464
+ is_pending_initial_payment && is_expired
465
+ }
454
466
}
455
467
456
468
struct PeerState {
@@ -488,6 +500,16 @@ impl PeerState {
488
500
} ,
489
501
}
490
502
} ) ;
503
+
504
+ self . outbound_channels_by_intercept_scid . retain ( |intercept_scid, entry| {
505
+ if entry. is_prunable ( ) {
506
+ // We abort the flow, and prune any data kept.
507
+ self . intercept_scid_by_channel_id . retain ( |_, iscid| intercept_scid != iscid) ;
508
+ self . intercept_scid_by_user_channel_id . retain ( |_, iscid| intercept_scid != iscid) ;
509
+ return false ;
510
+ }
511
+ true
512
+ } ) ;
491
513
}
492
514
}
493
515
You can’t perform that action at this time.
0 commit comments