Skip to content

Commit 55b712e

Browse files
committed
f clean up flow
1 parent 03c1795 commit 55b712e

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

lightning/src/ln/channelmanager.rs

+20-21
Original file line numberDiff line numberDiff line change
@@ -7663,30 +7663,29 @@ where
76637663
pending.len()
76647664
} else { 0 };
76657665

7666-
let channel =
7667-
if let Some(ChannelPhase::Funded(chan)) = peer_state.channel_by_id.get_mut(channel_id) {
7668-
chan
7669-
} else {
7670-
if remaining_in_flight != 0 {
7671-
return;
7672-
}
7673-
7674-
let update_actions = peer_state.monitor_update_blocked_actions
7675-
.remove(channel_id).unwrap_or(Vec::new());
7676-
mem::drop(peer_state_lock);
7677-
mem::drop(per_peer_state);
7678-
self.handle_monitor_update_completion_actions(update_actions);
7679-
return;
7680-
};
7666+
let logger = WithContext::from(&self.logger, Some(counterparty_node_id), Some(*channel_id), None);
7667+
log_trace!(logger, "ChannelMonitor updated to {}. {} pending in-flight updates.",
7668+
highest_applied_update_id, remaining_in_flight);
76817669

7682-
let logger = WithChannelContext::from(&self.logger, &channel.context, None);
7683-
log_trace!(logger, "ChannelMonitor updated to {}. Current highest is {}. {} pending in-flight updates.",
7684-
highest_applied_update_id, channel.context.get_latest_monitor_update_id(),
7685-
remaining_in_flight);
7686-
if remaining_in_flight != 0 || !channel.is_awaiting_monitor_update() {
7670+
if remaining_in_flight != 0 {
76877671
return;
76887672
}
7689-
handle_monitor_update_completion!(self, peer_state_lock, peer_state, per_peer_state, channel);
7673+
7674+
if let Some(ChannelPhase::Funded(chan)) = peer_state.channel_by_id.get_mut(channel_id) {
7675+
if chan.is_awaiting_monitor_update() {
7676+
log_trace!(logger, "Channel is open and awaiting update, resuming it");
7677+
handle_monitor_update_completion!(self, peer_state_lock, peer_state, per_peer_state, chan);
7678+
} else {
7679+
log_trace!(logger, "Channel is open but not awaiting update");
7680+
}
7681+
} else {
7682+
let update_actions = peer_state.monitor_update_blocked_actions
7683+
.remove(channel_id).unwrap_or(Vec::new());
7684+
log_trace!(logger, "Channel is closed, applying {} post-update actions", update_actions.len());
7685+
mem::drop(peer_state_lock);
7686+
mem::drop(per_peer_state);
7687+
self.handle_monitor_update_completion_actions(update_actions);
7688+
}
76907689
}
76917690

76927691
/// Accepts a request to open a channel after a [`Event::OpenChannelRequest`].

0 commit comments

Comments
 (0)