//! Consensus component for the node builder. use crate::{BuilderContext, FullNodeTypes}; use std::future::Future; /// A type that knows how to build the consensus implementation. pub trait ConsensusBuilder: Send { /// The consensus implementation to build. type Consensus: reth_consensus::Consensus + Clone + Unpin + 'static; /// Creates the consensus implementation. fn build_consensus( self, ctx: &BuilderContext, ) -> impl Future> + Send; } impl ConsensusBuilder for F where Node: FullNodeTypes, Consensus: reth_consensus::Consensus + Clone + Unpin + 'static, F: FnOnce(&BuilderContext) -> Fut + Send, Fut: Future> + Send, { type Consensus = Consensus; fn build_consensus( self, ctx: &BuilderContext, ) -> impl Future> { self(ctx) } }