@@ -3645,6 +3645,44 @@ macro_rules! handle_initial_monitor {
36453645 };
36463646}
36473647
3648+ macro_rules! handle_post_close_monitor_update {
3649+ (
3650+ $self: ident, $funding_txo: expr, $update: expr, $peer_state_lock: expr, $peer_state: expr,
3651+ $per_peer_state_lock: expr, $counterparty_node_id: expr, $channel_id: expr
3652+ ) => {{
3653+ let logger =
3654+ WithContext::from(&$self.logger, Some($counterparty_node_id), Some($channel_id), None);
3655+ let in_flight_updates;
3656+ let idx;
3657+ handle_new_monitor_update!(
3658+ $self,
3659+ $funding_txo,
3660+ $update,
3661+ $peer_state,
3662+ logger,
3663+ $channel_id,
3664+ $counterparty_node_id,
3665+ in_flight_updates,
3666+ idx,
3667+ _internal_outer,
3668+ {
3669+ let _ = in_flight_updates.remove(idx);
3670+ if in_flight_updates.is_empty() {
3671+ let update_actions = $peer_state
3672+ .monitor_update_blocked_actions
3673+ .remove(&$channel_id)
3674+ .unwrap_or(Vec::new());
3675+
3676+ mem::drop($peer_state_lock);
3677+ mem::drop($per_peer_state_lock);
3678+
3679+ $self.handle_monitor_update_completion_actions(update_actions);
3680+ }
3681+ }
3682+ )
3683+ }};
3684+ }
3685+
36483686macro_rules! handle_new_monitor_update {
36493687 (
36503688 $self: ident, $funding_txo: expr, $update: expr, $peer_state: expr, $logger: expr,
@@ -3719,41 +3757,6 @@ macro_rules! handle_new_monitor_update {
37193757 }
37203758 )
37213759 }};
3722- (
3723- $self: ident, $funding_txo: expr, $update: expr, $peer_state_lock: expr, $peer_state: expr,
3724- $per_peer_state_lock: expr, $counterparty_node_id: expr, $channel_id: expr, POST_CHANNEL_CLOSE
3725- ) => {{
3726- let logger =
3727- WithContext::from(&$self.logger, Some($counterparty_node_id), Some($channel_id), None);
3728- let in_flight_updates;
3729- let idx;
3730- handle_new_monitor_update!(
3731- $self,
3732- $funding_txo,
3733- $update,
3734- $peer_state,
3735- logger,
3736- $channel_id,
3737- $counterparty_node_id,
3738- in_flight_updates,
3739- idx,
3740- _internal_outer,
3741- {
3742- let _ = in_flight_updates.remove(idx);
3743- if in_flight_updates.is_empty() {
3744- let update_actions = $peer_state
3745- .monitor_update_blocked_actions
3746- .remove(&$channel_id)
3747- .unwrap_or(Vec::new());
3748-
3749- mem::drop($peer_state_lock);
3750- mem::drop($per_peer_state_lock);
3751-
3752- $self.handle_monitor_update_completion_actions(update_actions);
3753- }
3754- }
3755- )
3756- }};
37573760 (
37583761 $self: ident, $funding_txo: expr, $update: expr, $peer_state_lock: expr, $peer_state: expr,
37593762 $per_peer_state_lock: expr, $chan: expr
@@ -4464,9 +4467,9 @@ where
44644467 hash_map::Entry::Vacant(_) => {},
44654468 }
44664469
4467- handle_new_monitor_update !(
4470+ handle_post_close_monitor_update !(
44684471 self, funding_txo, monitor_update, peer_state_lock, peer_state, per_peer_state,
4469- counterparty_node_id, channel_id, POST_CHANNEL_CLOSE
4472+ counterparty_node_id, channel_id
44704473 );
44714474 }
44724475
@@ -8925,16 +8928,15 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
89258928 .push(action);
89268929 }
89278930
8928- handle_new_monitor_update !(
8931+ handle_post_close_monitor_update !(
89298932 self,
89308933 prev_hop.funding_txo,
89318934 preimage_update,
89328935 peer_state_lock,
89338936 peer_state,
89348937 per_peer_state,
89358938 prev_hop.counterparty_node_id,
8936- chan_id,
8937- POST_CHANNEL_CLOSE
8939+ chan_id
89388940 );
89398941 }
89408942
@@ -13345,16 +13347,15 @@ where
1334513347 };
1334613348 self.pending_background_events.lock().unwrap().push(event);
1334713349 } else {
13348- handle_new_monitor_update !(
13350+ handle_post_close_monitor_update !(
1334913351 self,
1335013352 channel_funding_outpoint,
1335113353 update,
1335213354 peer_state,
1335313355 peer_state,
1335413356 per_peer_state,
1335513357 counterparty_node_id,
13356- channel_id,
13357- POST_CHANNEL_CLOSE
13358+ channel_id
1335813359 );
1335913360 }
1336013361 },
0 commit comments