mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore: use fmt::Formatter helpers (#6775)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -6956,6 +6956,7 @@ dependencies = [
|
||||
"criterion",
|
||||
"fnv",
|
||||
"futures-util",
|
||||
"itertools 0.12.1",
|
||||
"metrics",
|
||||
"parking_lot 0.12.1",
|
||||
"paste",
|
||||
|
||||
@ -49,6 +49,7 @@ fnv = "1.0.7"
|
||||
bitflags.workspace = true
|
||||
auto_impl = "1.0"
|
||||
smallvec.workspace = true
|
||||
itertools.workspace = true
|
||||
|
||||
# testing
|
||||
rand = { workspace = true, optional = true }
|
||||
|
||||
@ -19,6 +19,7 @@ use crate::{
|
||||
ValidPoolTransaction, U256,
|
||||
};
|
||||
use fnv::FnvHashMap;
|
||||
use itertools::Itertools;
|
||||
use reth_primitives::{
|
||||
constants::{
|
||||
eip4844::BLOB_TX_MIN_BLOB_GASPRICE, ETHEREUM_BLOCK_GAS_LIMIT, MIN_PROTOCOL_BASE_FEE,
|
||||
@ -1819,21 +1820,21 @@ pub struct PruneResult<T: PoolTransaction> {
|
||||
}
|
||||
|
||||
impl<T: PoolTransaction> fmt::Debug for PruneResult<T> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(fmt, "PruneResult {{ ")?;
|
||||
write!(
|
||||
fmt,
|
||||
"promoted: {:?}, ",
|
||||
self.promoted.iter().map(|tx| *tx.hash()).collect::<Vec<_>>()
|
||||
)?;
|
||||
write!(fmt, "failed: {:?}, ", self.failed)?;
|
||||
write!(
|
||||
fmt,
|
||||
"pruned: {:?}, ",
|
||||
self.pruned.iter().map(|tx| *tx.transaction.hash()).collect::<Vec<_>>()
|
||||
)?;
|
||||
write!(fmt, "}}")?;
|
||||
Ok(())
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("PruneResult")
|
||||
.field(
|
||||
"promoted",
|
||||
&format_args!("[{}]", self.promoted.iter().map(|tx| tx.hash()).format(", ")),
|
||||
)
|
||||
.field("failed", &self.failed)
|
||||
.field(
|
||||
"pruned",
|
||||
&format_args!(
|
||||
"[{}]",
|
||||
self.pruned.iter().map(|tx| tx.transaction.hash()).format(", ")
|
||||
),
|
||||
)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -568,7 +568,7 @@ impl TransactionOrigin {
|
||||
/// known block hash.
|
||||
///
|
||||
/// This is used to update the pool state accordingly.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CanonicalStateUpdate<'a> {
|
||||
/// Hash of the tip block.
|
||||
pub new_tip: &'a SealedBlock,
|
||||
@ -613,10 +613,16 @@ impl<'a> CanonicalStateUpdate<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> fmt::Display for CanonicalStateUpdate<'a> {
|
||||
impl fmt::Display for CanonicalStateUpdate<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{{ hash: {}, number: {}, pending_block_base_fee: {}, pending_block_blob_fee: {:?}, changed_accounts: {}, mined_transactions: {} }}",
|
||||
self.hash(), self.number(), self.pending_block_base_fee, self.pending_block_blob_fee, self.changed_accounts.len(), self.mined_transactions.len())
|
||||
f.debug_struct("CanonicalStateUpdate")
|
||||
.field("hash", &self.hash())
|
||||
.field("number", &self.number())
|
||||
.field("pending_block_base_fee", &self.pending_block_base_fee)
|
||||
.field("pending_block_blob_fee", &self.pending_block_blob_fee)
|
||||
.field("changed_accounts", &self.changed_accounts.len())
|
||||
.field("mined_transactions", &self.mined_transactions.len())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user