mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
primitives: use alloy Header struct (#10691)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
//! Utility functions for node startup and shutdown, for example path parsing and retrieving single
|
||||
//! blocks from the network.
|
||||
|
||||
use alloy_primitives::Sealable;
|
||||
use eyre::Result;
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_consensus_common::validation::validate_block_pre_execution;
|
||||
@ -53,7 +54,9 @@ where
|
||||
eyre::bail!("Invalid number of headers received. Expected: 1. Received: {}", response.len())
|
||||
}
|
||||
|
||||
let header = response.into_iter().next().unwrap().seal_slow();
|
||||
let sealed_header = response.into_iter().next().unwrap().seal_slow();
|
||||
let (header, seal) = sealed_header.into_parts();
|
||||
let header = SealedHeader::new(header, seal);
|
||||
|
||||
let valid = match id {
|
||||
BlockHashOrNumber::Hash(hash) => header.hash() == hash,
|
||||
|
||||
@ -260,12 +260,12 @@ impl NodeState {
|
||||
hash=?block.hash(),
|
||||
peers=self.num_connected_peers(),
|
||||
txs=block.body.len(),
|
||||
gas=%format_gas(block.header.gas_used),
|
||||
gas_throughput=%format_gas_throughput(block.header.gas_used, elapsed),
|
||||
gas=%format_gas(block.header.gas_used as u64),
|
||||
gas_throughput=%format_gas_throughput(block.header.gas_used as u64, elapsed),
|
||||
full=%format!("{:.1}%", block.header.gas_used as f64 * 100.0 / block.header.gas_limit as f64),
|
||||
base_fee=%format!("{:.2}gwei", block.header.base_fee_per_gas.unwrap_or(0) as f64 / constants::GWEI_TO_WEI as f64),
|
||||
blobs=block.header.blob_gas_used.unwrap_or(0) / constants::eip4844::DATA_GAS_PER_BLOB,
|
||||
excess_blobs=block.header.excess_blob_gas.unwrap_or(0) / constants::eip4844::DATA_GAS_PER_BLOB,
|
||||
blobs=block.header.blob_gas_used.unwrap_or(0) as u64 / constants::eip4844::DATA_GAS_PER_BLOB,
|
||||
excess_blobs=block.header.excess_blob_gas.unwrap_or(0) as u64 / constants::eip4844::DATA_GAS_PER_BLOB,
|
||||
?elapsed,
|
||||
"Block added to canonical chain"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user