reth_chain_state

Trait ForkChoiceSubscriptions

Source
pub trait ForkChoiceSubscriptions: Send + Sync {
    type Header: Clone + Send + Sync + 'static;

    // Required methods
    fn subscribe_safe_block(&self) -> ForkChoiceNotifications<Self::Header>;
    fn subscribe_finalized_block(&self) -> ForkChoiceNotifications<Self::Header>;

    // Provided methods
    fn safe_block_stream(&self) -> ForkChoiceStream<SealedHeader<Self::Header>> { ... }
    fn finalized_block_stream(
        &self,
    ) -> ForkChoiceStream<SealedHeader<Self::Header>> { ... }
}
Expand description

A trait that allows to register to fork choice related events and get notified when a new fork choice is available.

Required Associated Types§

Source

type Header: Clone + Send + Sync + 'static

Block Header type.

Required Methods§

Source

fn subscribe_safe_block(&self) -> ForkChoiceNotifications<Self::Header>

Get notified when a new safe block of the chain is selected.

Source

fn subscribe_finalized_block(&self) -> ForkChoiceNotifications<Self::Header>

Get notified when a new finalized block of the chain is selected.

Provided Methods§

Source

fn safe_block_stream(&self) -> ForkChoiceStream<SealedHeader<Self::Header>>

Convenience method to get a stream of the new safe blocks of the chain.

Source

fn finalized_block_stream(&self) -> ForkChoiceStream<SealedHeader<Self::Header>>

Convenience method to get a stream of the new finalized blocks of the chain.

Implementations on Foreign Types§

Source§

impl<C: Send + Sync, N: NodePrimitives> ForkChoiceSubscriptions for NoopProvider<C, N>

Source§

type Header = <N as NodePrimitives>::BlockHeader

Source§

fn subscribe_safe_block(&self) -> ForkChoiceNotifications<N::BlockHeader>

Source§

fn subscribe_finalized_block(&self) -> ForkChoiceNotifications<N::BlockHeader>

Implementors§