reth_primitives_traits/header/
mod.rsmod sealed;
pub use sealed::SealedHeader;
mod error;
pub use error::HeaderError;
#[cfg(any(test, feature = "test-utils", feature = "arbitrary"))]
pub mod test_utils;
use alloy_consensus::Header;
use alloy_primitives::{Address, BlockNumber, B256, U256};
#[cfg(feature = "serde-bincode-compat")]
pub mod serde_bincode_compat {
pub use super::sealed::serde_bincode_compat::SealedHeader;
}
pub trait BlockHeader {
fn beneficiary(&self) -> Address;
fn difficulty(&self) -> U256;
fn number(&self) -> BlockNumber;
fn gas_limit(&self) -> u64;
fn timestamp(&self) -> u64;
fn mix_hash(&self) -> B256;
fn base_fee_per_gas(&self) -> Option<u64>;
fn excess_blob_gas(&self) -> Option<u64>;
}
impl BlockHeader for Header {
fn beneficiary(&self) -> Address {
self.beneficiary
}
fn difficulty(&self) -> U256 {
self.difficulty
}
fn number(&self) -> BlockNumber {
self.number
}
fn gas_limit(&self) -> u64 {
self.gas_limit
}
fn timestamp(&self) -> u64 {
self.timestamp
}
fn mix_hash(&self) -> B256 {
self.mix_hash
}
fn base_fee_per_gas(&self) -> Option<u64> {
self.base_fee_per_gas
}
fn excess_blob_gas(&self) -> Option<u64> {
self.excess_blob_gas
}
}