Skip to content

Commit b6b4426

Browse files
Add EventCompletionAction::AckMonitorEvent
When a payment's resolution is communicated to the downstream logic via Payment{Sent,Failed}, we may want to ack the monitor event that tells us about the payment's resolution in the ChannelMonitor to prevent the monitor event from being re-provided to us on startup. Used in upcoming commits.
1 parent fe3e82b commit b6b4426

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,14 @@ pub(crate) enum EventCompletionAction {
16131613
/// fully-resolved in the [`ChannelMonitor`], which we do via this action.
16141614
/// Note that this action will be dropped on downgrade to LDK prior to 0.2!
16151615
ReleasePaymentCompleteChannelMonitorUpdate(PaymentCompleteUpdate),
1616+
1617+
/// When a payment's resolution is communicated to the downstream logic via
1618+
/// [`Event::PaymentSent`] or [`Event::PaymentFailed`], we may want to ack the [`MonitorEvent`]
1619+
/// that tells us about the payment's resolution in the [`ChannelMonitor`] to prevent the monitor
1620+
/// event from being re-provided to us on startup.
1621+
AckMonitorEvent { event_source: MonitorEventSource },
16161622
}
1623+
16171624
impl_writeable_tlv_based_enum!(EventCompletionAction,
16181625
(0, ReleaseRAAChannelMonitorUpdate) => {
16191626
(0, channel_funding_outpoint, option),
@@ -1624,6 +1631,9 @@ impl_writeable_tlv_based_enum!(EventCompletionAction,
16241631
}
16251632
ChannelId::v1_from_funding_outpoint(channel_funding_outpoint.unwrap())
16261633
})),
1634+
},
1635+
(3, AckMonitorEvent) => {
1636+
(1, event_source, required),
16271637
}
16281638
{1, ReleasePaymentCompleteChannelMonitorUpdate} => (),
16291639
);
@@ -15590,6 +15600,9 @@ impl<
1559015600
}
1559115601
}
1559215602
},
15603+
EventCompletionAction::AckMonitorEvent { event_source } => {
15604+
self.chain_monitor.ack_monitor_event(event_source);
15605+
},
1559315606
}
1559415607
}
1559515608
}

0 commit comments

Comments
 (0)