@@ -3338,31 +3338,6 @@ macro_rules! handle_post_close_monitor_update {
33383338 update_completed
33393339 }};
33403340}
3341-
3342- /// Handles a new monitor update without dropping peer_state locks and calling
3343- /// [`ChannelManager::handle_monitor_update_completion_actions`] if the monitor update completed
3344- /// synchronously.
3345- ///
3346- /// Useful because monitor updates need to be handled in the same mutex where the channel generated
3347- /// them (otherwise they can end up getting applied out-of-order) but it's not always possible to
3348- /// drop the aforementioned peer state locks at a given callsite. In this situation, use this macro
3349- /// to apply the monitor update immediately and handle the monitor update completion actions at a
3350- /// later time.
3351- macro_rules! handle_new_monitor_update_locked_actions_handled_by_caller {
3352- (
3353- $self: ident, $funding_txo: expr, $update: expr, $in_flight_monitor_updates: expr, $chan_context: expr
3354- ) => {{
3355- let (update_completed, _all_updates_complete) = $self.handle_new_monitor_update_internal(
3356- $in_flight_monitor_updates,
3357- $chan_context.channel_id(),
3358- $funding_txo,
3359- $chan_context.get_counterparty_node_id(),
3360- $update,
3361- );
3362- update_completed
3363- }};
3364- }
3365-
33663341macro_rules! handle_new_monitor_update {
33673342 (
33683343 $self: ident, $funding_txo: expr, $update: expr, $peer_state_lock: expr, $peer_state: expr,
@@ -4546,12 +4521,12 @@ where
45464521 log_error!(logger, "Closed channel due to close-required error: {}", msg);
45474522
45484523 if let Some((_, funding_txo, _, update)) = shutdown_res.monitor_update.take() {
4549- handle_new_monitor_update_locked_actions_handled_by_caller!(
4550- self,
4524+ self.handle_new_monitor_update_internal(
4525+ in_flight_monitor_updates,
4526+ chan.context.channel_id(),
45514527 funding_txo,
4528+ chan.context.get_counterparty_node_id(),
45524529 update,
4553- in_flight_monitor_updates,
4554- chan.context
45554530 );
45564531 }
45574532 // If there's a possibility that we need to generate further monitor updates for this
@@ -14831,12 +14806,12 @@ where
1483114806 insert_short_channel_id!(short_to_chan_info, funded_channel);
1483214807
1483314808 if let Some(monitor_update) = monitor_update_opt {
14834- handle_new_monitor_update_locked_actions_handled_by_caller!(
14835- self,
14809+ self.handle_new_monitor_update_internal(
14810+ &mut peer_state.in_flight_monitor_updates,
14811+ funded_channel.context.channel_id(),
1483614812 funding_txo,
14813+ funded_channel.context.get_counterparty_node_id(),
1483714814 monitor_update,
14838- &mut peer_state.in_flight_monitor_updates,
14839- funded_channel.context
1484014815 );
1484114816 to_process_monitor_update_actions.push((
1484214817 counterparty_node_id, channel_id
0 commit comments