Skip to content

Commit 3add30b

Browse files
committed
f clean up flow
1 parent 940313b commit 3add30b

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
@@ -7682,30 +7682,29 @@ where
76827682
pending.len()
76837683
} else { 0 };
76847684

7685-
let channel =
7686-
if let Some(ChannelPhase::Funded(chan)) = peer_state.channel_by_id.get_mut(channel_id) {
7687-
chan
7688-
} else {
7689-
if remaining_in_flight != 0 {
7690-
return;
7691-
}
7692-
7693-
let update_actions = peer_state.monitor_update_blocked_actions
7694-
.remove(channel_id).unwrap_or(Vec::new());
7695-
mem::drop(peer_state_lock);
7696-
mem::drop(per_peer_state);
7697-
self.handle_monitor_update_completion_actions(update_actions);
7698-
return;
7699-
};
7685+
let logger = WithContext::from(&self.logger, Some(counterparty_node_id), Some(*channel_id), None);
7686+
log_trace!(logger, "ChannelMonitor updated to {}. {} pending in-flight updates.",
7687+
highest_applied_update_id, remaining_in_flight);
77007688

7701-
let logger = WithChannelContext::from(&self.logger, &channel.context, None);
7702-
log_trace!(logger, "ChannelMonitor updated to {}. Current highest is {}. {} pending in-flight updates.",
7703-
highest_applied_update_id, channel.context.get_latest_monitor_update_id(),
7704-
remaining_in_flight);
7705-
if remaining_in_flight != 0 || !channel.is_awaiting_monitor_update() {
7689+
if remaining_in_flight != 0 {
77067690
return;
77077691
}
7708-
handle_monitor_update_completion!(self, peer_state_lock, peer_state, per_peer_state, channel);
7692+
7693+
if let Some(ChannelPhase::Funded(chan)) = peer_state.channel_by_id.get_mut(channel_id) {
7694+
if chan.is_awaiting_monitor_update() {
7695+
log_trace!(logger, "Channel is open and awaiting update, resuming it");
7696+
handle_monitor_update_completion!(self, peer_state_lock, peer_state, per_peer_state, chan);
7697+
} else {
7698+
log_trace!(logger, "Channel is open but not awaiting update");
7699+
}
7700+
} else {
7701+
let update_actions = peer_state.monitor_update_blocked_actions
7702+
.remove(channel_id).unwrap_or(Vec::new());
7703+
log_trace!(logger, "Channel is closed, applying {} post-update actions", update_actions.len());
7704+
mem::drop(peer_state_lock);
7705+
mem::drop(per_peer_state);
7706+
self.handle_monitor_update_completion_actions(update_actions);
7707+
}
77097708
}
77107709

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

0 commit comments

Comments
 (0)