reth_node_builder/components/
consensus.rsuse crate::{BuilderContext, FullNodeTypes};
use std::future::Future;
pub trait ConsensusBuilder<Node: FullNodeTypes>: Send {
type Consensus: reth_consensus::Consensus + Clone + Unpin + 'static;
fn build_consensus(
self,
ctx: &BuilderContext<Node>,
) -> impl Future<Output = eyre::Result<Self::Consensus>> + Send;
}
impl<Node, F, Fut, Consensus> ConsensusBuilder<Node> for F
where
Node: FullNodeTypes,
Consensus: reth_consensus::Consensus + Clone + Unpin + 'static,
F: FnOnce(&BuilderContext<Node>) -> Fut + Send,
Fut: Future<Output = eyre::Result<Consensus>> + Send,
{
type Consensus = Consensus;
fn build_consensus(
self,
ctx: &BuilderContext<Node>,
) -> impl Future<Output = eyre::Result<Self::Consensus>> {
self(ctx)
}
}