From 11f4a55204dc6b3f210978b667ec1f4b3e7b1a8c Mon Sep 17 00:00:00 2001 From: Lucas Soriano del Pino Date: Mon, 20 Nov 2023 19:18:22 +1100 Subject: [PATCH] Log channel balances before deleting channel data It would be even nicer to log the `ChannelDetails`, but then we would have to modify the macro and that is too painful. --- lightning/src/ln/channelmanager.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index f65976c7622..d439e2af91b 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -1992,6 +1992,12 @@ macro_rules! try_chan_phase_entry { macro_rules! remove_channel_phase { ($self: expr, $entry: expr) => { { + let context = &$entry.get().context(); + let balance = context.get_available_balances(&$self.fee_estimator); + + log_debug!($self.logger, "Channel balance for {} before closure balance_msat={}, inbound_capacity_msat={}, outbound_capacity_msat={}", + log_bytes!(context.channel_id().0[..]), balance.balance_msat, balance.inbound_capacity_msat, balance.outbound_capacity_msat); + let channel = $entry.remove_entry().1; update_maps_on_chan_removal!($self, &channel.context()); channel