Skip to content

Commit de34adf

Browse files
committed
Add an additional variant to handle_new_monitor_update!
In d1c340a we added support in `handle_new_monitor_update!` for handling updates without dropping locks. 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 02a03fc commit de34adf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lightning/src/ln/channelmanager.rs

+21
Original file line numberDiff line numberDiff line change
@@ -3335,6 +3335,27 @@ macro_rules! handle_new_monitor_update {
33353335
let _ = in_flight_updates.remove(idx);
33363336
})
33373337
} };
3338+
(
3339+
$self: ident, $funding_txo: expr, $update: expr, $peer_state_lock: expr, $peer_state: expr,
3340+
$per_peer_state_lock: expr, $logger: expr, $channel_id: expr, POST_CHANNEL_CLOSE
3341+
) => { {
3342+
let in_flight_updates;
3343+
let idx;
3344+
handle_new_monitor_update!($self, $funding_txo, $update, $peer_state, $logger,
3345+
$channel_id, in_flight_updates, idx, _internal_outer,
3346+
{
3347+
let _ = in_flight_updates.remove(idx);
3348+
if in_flight_updates.is_empty() {
3349+
let update_actions = $peer_state.monitor_update_blocked_actions
3350+
.remove(&$channel_id).unwrap_or(Vec::new());
3351+
3352+
mem::drop($peer_state_lock);
3353+
mem::drop($per_peer_state_lock);
3354+
3355+
$self.handle_monitor_update_completion_actions(update_actions);
3356+
}
3357+
})
3358+
} };
33383359
(
33393360
$self: ident, $funding_txo: expr, $update: expr, $peer_state_lock: expr, $peer_state: expr,
33403361
$per_peer_state_lock: expr, $chan: expr

0 commit comments

Comments
 (0)