Skip to content

Commit 7cea2e9

Browse files
committed
Format convert_*_channel_err code moved out of macro
1 parent b6974a0 commit 7cea2e9

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3660,15 +3660,21 @@ where
36603660

36613661
if let Some((_, funding_txo, _, update)) = shutdown_res.monitor_update.take() {
36623662
handle_new_monitor_update_locked_actions_handled_by_caller!(
3663-
cm, funding_txo, update, in_flight_monitor_updates, chan.context
3663+
cm,
3664+
funding_txo,
3665+
update,
3666+
in_flight_monitor_updates,
3667+
chan.context
36643668
);
36653669
}
36663670
// If there's a possibility that we need to generate further monitor updates for this
36673671
// channel, we need to store the last update_id of it. However, we don't want to insert
36683672
// into the map (which prevents the `PeerState` from being cleaned up) for channels that
36693673
// never even got confirmations (which would open us up to DoS attacks).
36703674
let update_id = chan.context.get_latest_monitor_update_id();
3671-
if chan.funding.get_funding_tx_confirmation_height().is_some() || chan.context.minimum_depth(&chan.funding) == Some(0) || update_id > 1 {
3675+
let funding_confirmed = chan.funding.get_funding_tx_confirmation_height().is_some();
3676+
let chan_zero_conf = chan.context.minimum_depth(&chan.funding) == Some(0);
3677+
if funding_confirmed || chan_zero_conf || update_id > 1 {
36723678
closed_channel_monitor_update_ids.insert(chan_id, update_id);
36733679
}
36743680
let mut short_to_chan_info = cm.short_to_chan_info.write().unwrap();
@@ -3681,7 +3687,8 @@ where
36813687
// also don't want a counterparty to be able to trivially cause a memory leak by simply
36823688
// opening a million channels with us which are closed before we ever reach the funding
36833689
// stage.
3684-
let alias_removed = cm.outbound_scid_aliases.lock().unwrap().remove(&chan.context.outbound_scid_alias());
3690+
let outbound_alias = chan.context.outbound_scid_alias();
3691+
let alias_removed = cm.outbound_scid_aliases.lock().unwrap().remove(&outbound_alias);
36853692
debug_assert!(alias_removed);
36863693
}
36873694
short_to_chan_info.remove(&chan.context.outbound_scid_alias());
@@ -3713,7 +3720,8 @@ where
37133720
// also don't want a counterparty to be able to trivially cause a memory leak by simply
37143721
// opening a million channels with us which are closed before we ever reach the funding
37153722
// stage.
3716-
let alias_removed = cm.outbound_scid_aliases.lock().unwrap().remove(&chan.context().outbound_scid_alias());
3723+
let outbound_alias = chan.context().outbound_scid_alias();
3724+
let alias_removed = cm.outbound_scid_aliases.lock().unwrap().remove(&outbound_alias);
37173725
debug_assert!(alias_removed);
37183726
(shutdown_res, None)
37193727
})

0 commit comments

Comments
 (0)