-
Notifications
You must be signed in to change notification settings - Fork 463
Optimize block connection logging using LazyTxid #4659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, we really don't want to log every txid in the block - we have no idea if the transactions are event relevant to us at this point, and the list may well contain every single transaction in the block. |
||
| } | ||
|
Comment on lines
+16200
to
+16202
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This loop logs every transaction in 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 Consider either:
|
||
|
|
||
| let _persistence_guard = | ||
| PersistenceNotifierGuard::optionally_notify_skipping_background_events( | ||
|
|
@@ -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( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see what this is actually doing?