Skip to content

Commit c58cccf

Browse files
Extract util for XXX
1 parent 1c82b17 commit c58cccf

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3271,8 +3271,8 @@ macro_rules! locked_close_channel {
32713271
}};
32723272
($self: ident, $peer_state: expr, $funded_chan: expr, $shutdown_res_mut: expr, FUNDED) => {{
32733273
if let Some((_, funding_txo, _, update)) = $shutdown_res_mut.monitor_update.take() {
3274-
handle_new_monitor_update!($self, funding_txo, update, $peer_state,
3275-
$funded_chan.context, REMAIN_LOCKED_UPDATE_ACTIONS_PROCESSED_LATER);
3274+
handle_new_monitor_update_todo_name!($self, funding_txo, update, $peer_state,
3275+
$funded_chan.context);
32763276
}
32773277
// If there's a possibility that we need to generate further monitor updates for this
32783278
// channel, we need to store the last update_id of it. However, we don't want to insert
@@ -3666,6 +3666,7 @@ macro_rules! handle_post_close_monitor_update {
36663666
idx,
36673667
_internal_outer,
36683668
{
3669+
// If we get a monitor update for a closed channel
36693670
let _ = in_flight_updates.remove(idx);
36703671
if in_flight_updates.is_empty() {
36713672
let update_actions = $peer_state
@@ -3683,6 +3684,33 @@ macro_rules! handle_post_close_monitor_update {
36833684
}};
36843685
}
36853686

3687+
macro_rules! handle_new_monitor_update_todo_name {
3688+
(
3689+
$self: ident, $funding_txo: expr, $update: expr, $peer_state: expr, $chan_context: expr
3690+
) => {{
3691+
let logger = WithChannelContext::from(&$self.logger, &$chan_context, None);
3692+
let chan_id = $chan_context.channel_id();
3693+
let counterparty_node_id = $chan_context.get_counterparty_node_id();
3694+
let in_flight_updates;
3695+
let idx;
3696+
handle_new_monitor_update!(
3697+
$self,
3698+
$funding_txo,
3699+
$update,
3700+
$peer_state,
3701+
logger,
3702+
chan_id,
3703+
counterparty_node_id,
3704+
in_flight_updates,
3705+
idx,
3706+
_internal_outer,
3707+
{
3708+
let _ = in_flight_updates.remove(idx);
3709+
}
3710+
)
3711+
}};
3712+
}
3713+
36863714
macro_rules! handle_new_monitor_update {
36873715
(
36883716
$self: ident, $funding_txo: expr, $update: expr, $peer_state: expr, $logger: expr,
@@ -3732,31 +3760,6 @@ macro_rules! handle_new_monitor_update {
37323760
false
37333761
}
37343762
}};
3735-
(
3736-
$self: ident, $funding_txo: expr, $update: expr, $peer_state: expr, $chan_context: expr,
3737-
REMAIN_LOCKED_UPDATE_ACTIONS_PROCESSED_LATER
3738-
) => {{
3739-
let logger = WithChannelContext::from(&$self.logger, &$chan_context, None);
3740-
let chan_id = $chan_context.channel_id();
3741-
let counterparty_node_id = $chan_context.get_counterparty_node_id();
3742-
let in_flight_updates;
3743-
let idx;
3744-
handle_new_monitor_update!(
3745-
$self,
3746-
$funding_txo,
3747-
$update,
3748-
$peer_state,
3749-
logger,
3750-
chan_id,
3751-
counterparty_node_id,
3752-
in_flight_updates,
3753-
idx,
3754-
_internal_outer,
3755-
{
3756-
let _ = in_flight_updates.remove(idx);
3757-
}
3758-
)
3759-
}};
37603763
(
37613764
$self: ident, $funding_txo: expr, $update: expr, $peer_state_lock: expr, $peer_state: expr,
37623765
$per_peer_state_lock: expr, $chan: expr
@@ -14039,13 +14042,12 @@ where
1403914042
insert_short_channel_id!(short_to_chan_info, funded_channel);
1404014043

1404114044
if let Some(monitor_update) = monitor_update_opt {
14042-
handle_new_monitor_update!(
14045+
handle_new_monitor_update_todo_name!(
1404314046
self,
1404414047
funding_txo,
1404514048
monitor_update,
1404614049
peer_state,
14047-
funded_channel.context,
14048-
REMAIN_LOCKED_UPDATE_ACTIONS_PROCESSED_LATER
14050+
funded_channel.context
1404914051
);
1405014052
to_process_monitor_update_actions.push((
1405114053
counterparty_node_id, channel_id

0 commit comments

Comments
 (0)