reth_storage_api/chain_info.rs
1use alloy_rpc_types_engine::ForkchoiceState;
2use reth_primitives_traits::SealedHeader;
3
4/// A type that can track updates related to fork choice updates.
5pub trait CanonChainTracker: Send + Sync {
6 /// The header type.
7 type Header: Send + Sync;
8
9 /// Notify the tracker about a received fork choice update.
10 fn on_forkchoice_update_received(&self, update: &ForkchoiceState);
11
12 /// Returns the last time a fork choice update was received from the CL
13 /// ([`CanonChainTracker::on_forkchoice_update_received`])
14 #[cfg(feature = "std")]
15 fn last_received_update_timestamp(&self) -> Option<std::time::Instant>;
16
17 /// Sets the canonical head of the chain.
18 fn set_canonical_head(&self, header: SealedHeader<Self::Header>);
19
20 /// Sets the safe block of the chain.
21 fn set_safe(&self, header: SealedHeader<Self::Header>);
22
23 /// Sets the finalized block of the chain.
24 fn set_finalized(&self, header: SealedHeader<Self::Header>);
25}