Skip to content

Commit deb613a

Browse files
committed
Add additional variants to handle_new_monitor_update!
In the coming commits we'll start handling `ChannelMonitorUpdate`s during channel closure in-line rather than after dropping locks via `finish_close_channel`. In order to make that easy, here we add a new `REMAIN_LOCKED_UPDATE_ACTIONS_PROCESSED_LATER` variant to `handle_new_monitor_update!` which can attempt to apply an update without dropping the locks and processing `MonitorUpdateCompletionAction`s immediately. In the coming commits we'll start handling `ChannelMonitorUpdate`s "like normal" for updates against closed channels. Here we set up the first step by adding a new `POST_CHANNEL_CLOSE` variant on `handle_new_monitor_update!` which attempts to handle the `ChannelMonitorUpdate` and handles completion actions if it finishes immediately, just like the pre-close variant.
1 parent a8c9da4 commit deb613a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3309,6 +3309,27 @@ macro_rules! handle_new_monitor_update {
33093309
let _ = in_flight_updates.remove(idx);
33103310
})
33113311
} };
3312+
(
3313+
$self: ident, $funding_txo: expr, $update: expr, $peer_state_lock: expr, $peer_state: expr,
3314+
$per_peer_state_lock: expr, $logger: expr, $channel_id: expr, POST_CHANNEL_CLOSE
3315+
) => { {
3316+
let in_flight_updates;
3317+
let idx;
3318+
handle_new_monitor_update!($self, $funding_txo, $update, $peer_state, $logger,
3319+
$channel_id, in_flight_updates, idx, _internal_outer,
3320+
{
3321+
let _ = in_flight_updates.remove(idx);
3322+
if in_flight_updates.is_empty() {
3323+
let update_actions = $peer_state.monitor_update_blocked_actions
3324+
.remove(&$channel_id).unwrap_or(Vec::new());
3325+
3326+
mem::drop($peer_state_lock);
3327+
mem::drop($per_peer_state_lock);
3328+
3329+
$self.handle_monitor_update_completion_actions(update_actions);
3330+
}
3331+
})
3332+
} };
33123333
(
33133334
$self: ident, $funding_txo: expr, $update: expr, $peer_state_lock: expr, $peer_state: expr,
33143335
$per_peer_state_lock: expr, $chan: expr

0 commit comments

Comments
 (0)