Skip to content
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

Only log the propagating transactions when they are not empty #5424

Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions prdoc/pr_5424.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Suppress the log output for transaction propagation when no transactions are present

doc:
- audience: Node Dev
description: |
Previously, the log message `Propagating transactions` would always be printed, even when there were no transactions to propagate. This patch optimizes the logging by returning early when no transactions are present, resulting in cleaner and more relevant log output.

crates:
- name: sc-network-transactions
bump: none
8 changes: 7 additions & 1 deletion substrate/client/network/transactions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,14 @@ where
return
}

debug!(target: LOG_TARGET, "Propagating transactions");
let transactions = self.transaction_pool.transactions();

if transactions.is_empty() {
return
}

debug!(target: LOG_TARGET, "Propagating transactions");

let propagated_to = self.do_propagate_transactions(&transactions);
self.transaction_pool.on_broadcasted(propagated_to);
}
Expand Down
Loading