Skip to content

Commit 5c6f09d

Browse files
Add EventCompletionAction::AckMonitorEvent
If ChannelManager::persistent_monitor_events is enabled, we may want to avoid acking a monitor event until after an Event is processed by the user. In upcoming commits, we'll use this to ensure a MonitorEvent::HTLCEvent will keep being re-provided back to us until after an Event::PaymentSent is processed.
1 parent cb071ef commit 5c6f09d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lightning/src/ln/channelmanager.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,11 @@ pub(crate) enum EventCompletionAction {
16351635
/// fully-resolved in the [`ChannelMonitor`], which we do via this action.
16361636
/// Note that this action will be dropped on downgrade to LDK prior to 0.2!
16371637
ReleasePaymentCompleteChannelMonitorUpdate(PaymentCompleteUpdate),
1638+
/// If [`ChannelManager::persistent_monitor_events`] is enabled, we may want to avoid acking a
1639+
/// monitor event via [`Watch::ack_monitor_event`] until after an [`Event`] is processed by the
1640+
/// user. For example, we may want a [`MonitorEvent::HTLCEvent`] to keep being re-provided to us
1641+
/// until after an [`Event::PaymentSent`] is processed.
1642+
AckMonitorEvent { event_id: MonitorEventSource },
16381643
}
16391644
impl_writeable_tlv_based_enum!(EventCompletionAction,
16401645
(0, ReleaseRAAChannelMonitorUpdate) => {
@@ -1646,6 +1651,9 @@ impl_writeable_tlv_based_enum!(EventCompletionAction,
16461651
}
16471652
ChannelId::v1_from_funding_outpoint(channel_funding_outpoint.unwrap())
16481653
})),
1654+
},
1655+
(3, AckMonitorEvent) => {
1656+
(1, event_id, required),
16491657
}
16501658
{1, ReleasePaymentCompleteChannelMonitorUpdate} => (),
16511659
);
@@ -15659,6 +15667,9 @@ impl<
1565915667
}
1566015668
}
1566115669
},
15670+
EventCompletionAction::AckMonitorEvent { event_id } => {
15671+
self.chain_monitor.ack_monitor_event(event_id);
15672+
},
1566215673
}
1566315674
}
1566415675
}

0 commit comments

Comments
 (0)