mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-04 03:55:22 -05:00
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use alloc::vec::Vec;
|
||||
use alloy_consensus::{
|
||||
transaction::PooledTransaction, Header, TxEip1559, TxEip2930, TxEip4844, TxEip4844WithSidecar,
|
||||
TxEip7702, TxLegacy, TxType,
|
||||
transaction::PooledTransaction, Header, TxEip1559, TxEip2930, TxEip4844, TxEip4844Variant,
|
||||
TxEip4844WithSidecar, TxEip7702, TxEnvelope, TxLegacy, TxType,
|
||||
};
|
||||
use alloy_eips::eip4895::Withdrawals;
|
||||
use alloy_primitives::{PrimitiveSignature as Signature, TxHash, B256};
|
||||
@@ -57,6 +57,7 @@ impl_in_mem_size!(
|
||||
TxEip1559,
|
||||
TxEip7702,
|
||||
TxEip4844,
|
||||
TxEip4844Variant,
|
||||
TxEip4844WithSidecar
|
||||
);
|
||||
|
||||
@@ -84,6 +85,18 @@ impl InMemorySize for PooledTransaction {
|
||||
}
|
||||
}
|
||||
|
||||
impl InMemorySize for TxEnvelope {
|
||||
fn size(&self) -> usize {
|
||||
match self {
|
||||
Self::Legacy(tx) => tx.size(),
|
||||
Self::Eip2930(tx) => tx.size(),
|
||||
Self::Eip1559(tx) => tx.size(),
|
||||
Self::Eip4844(tx) => tx.size(),
|
||||
Self::Eip7702(tx) => tx.size(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: InMemorySize, H: InMemorySize> InMemorySize for alloy_consensus::BlockBody<T, H> {
|
||||
/// Calculates a heuristic for the in-memory size of the block body
|
||||
#[inline]
|
||||
@@ -148,6 +161,18 @@ mod op {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl InMemorySize for op_alloy_consensus::OpTxEnvelope {
|
||||
fn size(&self) -> usize {
|
||||
match self {
|
||||
Self::Legacy(tx) => tx.size(),
|
||||
Self::Eip2930(tx) => tx.size(),
|
||||
Self::Eip1559(tx) => tx.size(),
|
||||
Self::Eip7702(tx) => tx.size(),
|
||||
Self::Deposit(tx) => tx.size(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
Reference in New Issue
Block a user