Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16191,6 +16191,15 @@ 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 {}", LazyTxid(tx), block_hash, height);
}
Comment on lines +16200 to +16202
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop logs every transaction in txdata, but txdata is not necessarily filtered to only channel-relevant transactions. In the Listen::block_connectedfiltered_block_connectedtransactions_confirmed path, txdata contains all transactions in the block (see block_connected default impl in chain/mod.rs:190-192). Even with BIP 157/158 compact block filters, the filtering is block-level, not transaction-level, so a matching block still delivers all its transactions here.

On mainnet blocks with ~2000-3000 transactions, this produces thousands of DEBUG log lines per block (~every 10 minutes), almost all for transactions completely unrelated to the node's channels. If DEBUG is enabled, each line also triggers a compute_txid() (double-SHA256 of the serialized transaction).

Consider either:

  1. Moving this logging after channel processing so you only log transactions that actually triggered a channel update, or
  2. Gating this on TRACE instead of DEBUG, consistent with the existing aggregate log on the line above.


let _persistence_guard =
PersistenceNotifierGuard::optionally_notify_skipping_background_events(
Expand Down Expand Up @@ -16222,7 +16231,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(
Expand Down
Loading