From fdfef44b0732e9fc179a9d7a0347690a6b1e51bc Mon Sep 17 00:00:00 2001 From: Alkamal01 Date: Sat, 2 May 2026 17:50:44 +0100 Subject: [PATCH 1/2] channelmanager: improve block connection logging Upgrade best_block_updated log from TRACE to INFO so chain tip updates are visible without enabling full trace logging. Add per-txid DEBUG logs in transactions_confirmed to make it easier to identify which transactions triggered channel updates. --- lightning/src/ln/channelmanager.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index a3c33b8320f..7aac2c51131 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -15968,6 +15968,9 @@ impl< let block_hash = header.block_hash(); log_trace!(self.logger, "{} transactions included in block {} at height {} provided", txdata.len(), block_hash, height); + for (_, tx) in txdata.iter() { + log_debug!(self.logger, "Confirmed transaction {} in block {} at height {}", tx.compute_txid(), block_hash, height); + } let _persistence_guard = PersistenceNotifierGuard::optionally_notify_skipping_background_events( @@ -15999,7 +16002,7 @@ impl< // See the docs for `ChannelManagerReadArgs` for more. let block_hash = header.block_hash(); - log_trace!(self.logger, "New best block: {} at height {}", block_hash, height); + log_info!(self.logger, "New best block: {} at height {}", block_hash, height); let _persistence_guard = PersistenceNotifierGuard::optionally_notify_skipping_background_events( From 985a82bbc879aeb50ceb541c8dbc54cf73aedbec Mon Sep 17 00:00:00 2001 From: Alkamal01 Date: Sun, 3 May 2026 06:55:30 +0100 Subject: [PATCH 2/2] Address review feedback: defer double-SHA256 computations in debug logging Use a lazy Display wrapper to format confirmed txids, preventing unconditional hashing when DEBUG logging is disabled. --- lightning/src/ln/channelmanager.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 7aac2c51131..eb433f2dd00 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -15968,8 +15968,14 @@ impl< let block_hash = header.block_hash(); log_trace!(self.logger, "{} transactions included in block {} at height {} provided", txdata.len(), block_hash, height); + struct LazyTxid<'a>(&'a Transaction); + impl<'a> core::fmt::Display for LazyTxid<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + write!(f, "{}", self.0.compute_txid()) + } + } for (_, tx) in txdata.iter() { - log_debug!(self.logger, "Confirmed transaction {} in block {} at height {}", tx.compute_txid(), block_hash, height); + log_debug!(self.logger, "Confirmed transaction {} in block {} at height {}", LazyTxid(tx), block_hash, height); } let _persistence_guard =