From 9125de22c5269d67b76a06fd66fa88fb1d68414c Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 13 Feb 2024 23:33:18 +0000 Subject: [PATCH] Opportunistically skip log in `update_claims_view_from_requests` On each block, for each `ChannelMonitor`, we log a status statement in `OnChainTx::update_claims_view_from_requests`. This can add up to quite a bit, and is generally not very interesting when we don't actually do anything if there's no claims to bump. Here we drop the log if we have no claims to work with, but retain it if we process any claims. --- lightning/src/chain/onchaintx.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lightning/src/chain/onchaintx.rs b/lightning/src/chain/onchaintx.rs index 6c29d147..a95cf774 100644 --- a/lightning/src/chain/onchaintx.rs +++ b/lightning/src/chain/onchaintx.rs @@ -726,7 +726,10 @@ impl OnchainTxHandler B::Target: BroadcasterInterface, F::Target: FeeEstimator, { - log_debug!(logger, "Updating claims view at height {} with {} claim requests", cur_height, requests.len()); + if !requests.is_empty() { + log_debug!(logger, "Updating claims view at height {} with {} claim requests", cur_height, requests.len()); + } + let mut preprocessed_requests = Vec::with_capacity(requests.len()); let mut aggregated_request = None; @@ -772,6 +775,12 @@ impl OnchainTxHandler // Claim everything up to and including `cur_height` let remaining_locked_packages = self.locktimed_packages.split_off(&(cur_height + 1)); + if !self.locktimed_packages.is_empty() { + log_debug!(logger, + "Updating claims view at height {} with {} locked packages available for claim", + cur_height, + self.locktimed_packages.len()); + } for (pop_height, mut entry) in self.locktimed_packages.iter_mut() { log_trace!(logger, "Restoring delayed claim of package(s) at their timelock at {}.", pop_height); preprocessed_requests.append(&mut entry); -- 2.30.2