Skip to content
Snippets Groups Projects
Unverified Commit 6ecbde33 authored by Liu-Cheng Xu's avatar Liu-Cheng Xu Committed by GitHub
Browse files

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

This can make the log cleaner, especially when you specify `--log
sync=debug`.
parent b34d4a08
No related merge requests found
Pipeline #492995 waiting for manual action with stages
in 1 hour, 18 minutes, and 54 seconds
# 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
......@@ -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);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment