Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
- index 8a7b88859..dd17fe697 100644
- --- a/lightning/src/ln/channelmanager.rs
- +++ b/lightning/src/ln/channelmanager.rs
- @@ -1397,22 +1397,20 @@ pub(crate) enum MonitorUpdateCompletionAction {
- /// completes a monitor update containing the payment preimage. In that case, after the inbound
- /// edge completes, we will surface an [`Event::PaymentForwarded`] as well as unblock the
- /// outbound edge.
- - EmitEventOptionAndFreeOtherChannel {
- - event: Option<events::Event>,
- + EmitEventAndFreeOtherChannel {
- + event: events::Event,
- downstream_counterparty_and_funding_outpoint: Option<EventUnblockedChannel>,
- },
- - /// Indicates we should immediately resume the operation of another channel, unless there is
- - /// some other reason why the channel is blocked. In practice this simply means immediately
- - /// removing the [`RAAMonitorUpdateBlockingAction`] provided from the blocking set.
- + /// Indicates we should resume the operation of another channel, unless there is some other
- + /// reason why the channel is blocked. In practice this simply means removing the
- + /// [`RAAMonitorUpdateBlockingAction`] provided from the blocking set.
- ///
- /// This is usually generated when we've forwarded an HTLC and want to block the outbound edge
- /// from completing a monitor update which removes the payment preimage until the inbound edge
- /// completes a monitor update containing the payment preimage. However, we use this variant
- - /// instead of [`Self::EmitEventOptionAndFreeOtherChannel`] when we discover that the claim was
- - /// in fact duplicative and we simply want to resume the outbound edge channel immediately.
- - ///
- - /// This variant should thus never be written to disk, as it is processed inline rather than
- - /// stored for later processing.
- + /// instead of [`Self::EmitEventAndFreeOtherChannel`] when we discover that the claim was
- + /// in fact duplicative, or for trampoline payments with multiple incoming HTLCs where we
- + /// only want to emit a single event for the entire payment.
- FreeOtherChannelImmediately {
- downstream_counterparty_node_id: PublicKey,
- blocking_action: RAAMonitorUpdateBlockingAction,
- @@ -1432,11 +1430,8 @@ impl_writeable_tlv_based_enum_upgradable!(MonitorUpdateCompletionAction,
- (4, blocking_action, upgradable_required),
- (5, downstream_channel_id, required),
- },
- - (2, EmitEventOptionAndFreeOtherChannel) => {
- - // LDK prior to 0.3 required this field. It will not be present for trampoline payments
- - // with multiple incoming HTLCS, so nodes cannot downgrade while trampoline payments
- - // are in the process of being resolved.
- - (0, event, upgradable_option),
- + (2, EmitEventAndFreeOtherChannel) => {
- + (0, event, upgradable_required),
- // LDK prior to 0.0.116 did not have this field as the monitor update application order was
- // required by clients. If we downgrade to something prior to 0.0.116 this may result in
- // monitor updates which aren't properly blocked or resumed, however that's fine - we don't
- @@ -9259,21 +9254,29 @@ where
- } else {
- (None, None)
- }
- - } else {
- - let event = make_payment_forwarded_event(htlc_claim_value_msat);
- - if let Some(ref payment_forwarded) = event {
- - debug_assert!(matches!(
- - payment_forwarded,
- - &events::Event::PaymentForwarded { .. }
- - ));
- - }
- + } else if let Some(event) = make_payment_forwarded_event(htlc_claim_value_msat) {
- + debug_assert!(matches!(
- + event,
- + events::Event::PaymentForwarded { .. }
- + ));
- (
- - Some(MonitorUpdateCompletionAction::EmitEventOptionAndFreeOtherChannel {
- + Some(MonitorUpdateCompletionAction::EmitEventAndFreeOtherChannel {
- event,
- downstream_counterparty_and_funding_outpoint: chan_to_release,
- }),
- None,
- )
- + } else if let Some(chan) = chan_to_release {
- + (
- + Some(MonitorUpdateCompletionAction::FreeOtherChannelImmediately {
- + downstream_counterparty_node_id: chan.counterparty_node_id,
- + downstream_channel_id: chan.channel_id,
- + blocking_action: chan.blocking_action,
- + }),
- + None,
- + )
- + } else {
- + (None, None)
- }
- },
- );
- @@ -9952,13 +9955,11 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
- }
- }
- },
- - MonitorUpdateCompletionAction::EmitEventOptionAndFreeOtherChannel {
- + MonitorUpdateCompletionAction::EmitEventAndFreeOtherChannel {
- event,
- downstream_counterparty_and_funding_outpoint,
- } => {
- - if let Some(event) = event {
- - self.pending_events.lock().unwrap().push_back((event, None));
- - }
- + self.pending_events.lock().unwrap().push_back((event, None));
- if let Some(unblocked) = downstream_counterparty_and_funding_outpoint {
- self.handle_monitor_update_release(
- unblocked.counterparty_node_id,
- @@ -18740,7 +18741,7 @@ where
- let logger =
- WithContext::from(&args.logger, Some(node_id), Some(*channel_id), None);
- for action in actions.iter() {
- - if let MonitorUpdateCompletionAction::EmitEventOptionAndFreeOtherChannel {
- + if let MonitorUpdateCompletionAction::EmitEventAndFreeOtherChannel {
- downstream_counterparty_and_funding_outpoint:
- Some(EventUnblockedChannel {
- counterparty_node_id: blocked_node_id,
- @@ -18770,12 +18771,6 @@ where
- // anymore.
- }
- }
- - if let MonitorUpdateCompletionAction::FreeOtherChannelImmediately {
- - ..
- - } = action
- - {
- - debug_assert!(false, "Non-event-generating channel freeing should not appear in our queue");
- - }
- }
- // Note that we may have a post-update action for a channel that has no pending
- // `ChannelMonitorUpdate`s, but unlike the no-peer-state case, it may simply be
Advertisement
Add Comment
Please, Sign In to add comment