Log when a ChannelMonitor's claimable balances set goes empty 2024-04-2964-followups
authorMatt Corallo <git@bluematt.me>
Thu, 18 Apr 2024 21:42:48 +0000 (21:42 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 22 Apr 2024 12:24:00 +0000 (12:24 +0000)
lightning/src/chain/channelmonitor.rs

index 853fbbbe8bf147d217b9df305bf73f087fc259ed..58d9795978f3d8ca90270fb4d5ef3f65b4ac48db 100644 (file)
@@ -1878,10 +1878,10 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
                        }
                }
 
+               const BLOCKS_THRESHOLD: u32 = 4032; // ~four weeks
                match (inner.balances_empty_height, is_all_funds_claimed) {
                        (Some(balances_empty_height), true) => {
                                // Claimed all funds, check if reached the blocks threshold.
-                               const BLOCKS_THRESHOLD: u32 = 4032; // ~four weeks
                                return current_height >= balances_empty_height + BLOCKS_THRESHOLD;
                        },
                        (Some(_), false) => {
@@ -1897,6 +1897,9 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
                        (None, true) => {
                                // Claimed all funds but `balances_empty_height` is None. It is set to the
                                // current block height.
+                               log_debug!(logger,
+                                       "ChannelMonitor funded at {} is now fully resolved. It will become archivable in {} blocks",
+                                       inner.get_funding_txo().0, BLOCKS_THRESHOLD);
                                inner.balances_empty_height = Some(current_height);
                                false
                        },