Skip to content

Commit 615a1f1

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 6fca688 commit 615a1f1

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
@@ -3339,6 +3339,27 @@ macro_rules! handle_new_monitor_update {
33393339
let _ = in_flight_updates.remove(idx);
33403340
})
33413341
} };
3342+
(
3343+
$self: ident, $funding_txo: expr, $update: expr, $peer_state_lock: expr, $peer_state: expr,
3344+
$per_peer_state_lock: expr, $logger: expr, $channel_id: expr, POST_CHANNEL_CLOSE
3345+
) => { {
3346+
let in_flight_updates;
3347+
let idx;
3348+
handle_new_monitor_update!($self, $funding_txo, $update, $peer_state, $logger,
3349+
$channel_id, in_flight_updates, idx, _internal_outer,
3350+
{
3351+
let _ = in_flight_updates.remove(idx);
3352+
if in_flight_updates.is_empty() {
3353+
let update_actions = $peer_state.monitor_update_blocked_actions
3354+
.remove(&$channel_id).unwrap_or(Vec::new());
3355+
3356+
mem::drop($peer_state_lock);
3357+
mem::drop($per_peer_state_lock);
3358+
3359+
$self.handle_monitor_update_completion_actions(update_actions);
3360+
}
3361+
})
3362+
} };
33423363
(
33433364
$self: ident, $funding_txo: expr, $update: expr, $peer_state_lock: expr, $peer_state: expr,
33443365
$per_peer_state_lock: expr, $chan: expr

0 commit comments

Comments
 (0)