mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add Display for BeaconConsensusEngineEvent (#11055)
This commit is contained in:
@ -2,7 +2,11 @@ use crate::engine::forkchoice::ForkchoiceStatus;
|
||||
use alloy_primitives::B256;
|
||||
use reth_primitives::{SealedBlock, SealedHeader};
|
||||
use reth_rpc_types::engine::ForkchoiceState;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
use std::{
|
||||
fmt::{Display, Formatter, Result},
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
/// Events emitted by [`crate::BeaconConsensusEngine`].
|
||||
#[derive(Clone, Debug)]
|
||||
@ -30,6 +34,28 @@ impl BeaconConsensusEngineEvent {
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for BeaconConsensusEngineEvent {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
||||
match self {
|
||||
Self::ForkchoiceUpdated(state, status) => {
|
||||
write!(f, "ForkchoiceUpdated({state:?}, {status:?})")
|
||||
}
|
||||
Self::ForkBlockAdded(block, duration) => {
|
||||
write!(f, "ForkBlockAdded({:?}, {duration:?})", block.num_hash())
|
||||
}
|
||||
Self::CanonicalBlockAdded(block, duration) => {
|
||||
write!(f, "CanonicalBlockAdded({:?}, {duration:?})", block.num_hash())
|
||||
}
|
||||
Self::CanonicalChainCommitted(block, duration) => {
|
||||
write!(f, "CanonicalChainCommitted({:?}, {duration:?})", block.num_hash())
|
||||
}
|
||||
Self::LiveSyncProgress(progress) => {
|
||||
write!(f, "LiveSyncProgress({progress:?})")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Progress of the consensus engine during live sync.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum ConsensusEngineLiveSyncProgress {
|
||||
|
||||
Reference in New Issue
Block a user