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.
This commit is contained in:
Matt Corallo 2024-02-13 23:33:18 +00:00
parent aab5b102e4
commit 9125de22c5

View file

@ -726,7 +726,10 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner>
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<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner>
// 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);