mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 00:11:01 +00:00
Improve logging for transaction pool (#6152)
* improve logging * Update client/transaction-pool/graph/src/validated_pool.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * address review and make uniform Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
This commit is contained in:
@@ -27,7 +27,6 @@ use crate::listener::Listener;
|
||||
use crate::rotator::PoolRotator;
|
||||
use crate::watcher::Watcher;
|
||||
use serde::Serialize;
|
||||
use log::{debug, warn};
|
||||
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use sp_runtime::{
|
||||
@@ -189,11 +188,11 @@ impl<B: ChainApi> ValidatedPool<B> {
|
||||
let ready_limit = &self.options.ready;
|
||||
let future_limit = &self.options.future;
|
||||
|
||||
debug!(target: "txpool", "Pool Status: {:?}", status);
|
||||
log::debug!(target: "txpool", "Pool Status: {:?}", status);
|
||||
if ready_limit.is_exceeded(status.ready, status.ready_bytes)
|
||||
|| future_limit.is_exceeded(status.future, status.future_bytes)
|
||||
{
|
||||
debug!(
|
||||
log::debug!(
|
||||
target: "txpool",
|
||||
"Enforcing limits ({}/{}kB ready, {}/{}kB future",
|
||||
ready_limit.count, ready_limit.total_bytes / 1024,
|
||||
@@ -209,8 +208,11 @@ impl<B: ChainApi> ValidatedPool<B> {
|
||||
self.rotator.ban(&Instant::now(), removed.iter().map(|x| x.clone()));
|
||||
removed
|
||||
};
|
||||
if !removed.is_empty() {
|
||||
log::debug!(target: "txpool", "Enforcing limits: {} dropped", removed.len());
|
||||
}
|
||||
|
||||
// run notifications
|
||||
debug!(target: "txpool", "Enforcing limits: {} dropped", removed.len());
|
||||
let mut listener = self.listener.write();
|
||||
for h in &removed {
|
||||
listener.dropped(h, None);
|
||||
@@ -324,7 +326,7 @@ impl<B: ChainApi> ValidatedPool<B> {
|
||||
// we do not want to fail if single transaction import has failed
|
||||
// nor we do want to propagate this error, because it could tx unknown to caller
|
||||
// => let's just notify listeners (and issue debug message)
|
||||
warn!(
|
||||
log::warn!(
|
||||
target: "txpool",
|
||||
"[{:?}] Removing invalid transaction from update: {}",
|
||||
hash,
|
||||
@@ -531,14 +533,14 @@ impl<B: ChainApi> ValidatedPool<B> {
|
||||
return vec![];
|
||||
}
|
||||
|
||||
debug!(target: "txpool", "Removing invalid transactions: {:?}", hashes);
|
||||
log::debug!(target: "txpool", "Removing invalid transactions: {:?}", hashes);
|
||||
|
||||
// temporarily ban invalid transactions
|
||||
self.rotator.ban(&Instant::now(), hashes.iter().cloned());
|
||||
|
||||
let invalid = self.pool.write().remove_subtree(hashes);
|
||||
|
||||
debug!(target: "txpool", "Removed invalid transactions: {:?}", invalid);
|
||||
log::debug!(target: "txpool", "Removed invalid transactions: {:?}", invalid);
|
||||
|
||||
let mut listener = self.listener.write();
|
||||
for tx in &invalid {
|
||||
@@ -560,7 +562,7 @@ impl<B: ChainApi> ValidatedPool<B> {
|
||||
|
||||
/// Notify all watchers that transactions in the block with hash have been finalized
|
||||
pub async fn on_block_finalized(&self, block_hash: BlockHash<B>) -> Result<(), B::Error> {
|
||||
debug!(target: "txpool", "Attempting to notify watchers of finalization for {}", block_hash);
|
||||
log::trace!(target: "txpool", "Attempting to notify watchers of finalization for {}", block_hash);
|
||||
self.listener.write().finalized(block_hash);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user