mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore: move consensus instantiation to fn (#5208)
This commit is contained in:
@ -262,12 +262,7 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
|
|||||||
|
|
||||||
info!(target: "reth::cli", "{}", DisplayHardforks::from(self.chain.hardforks().clone()));
|
info!(target: "reth::cli", "{}", DisplayHardforks::from(self.chain.hardforks().clone()));
|
||||||
|
|
||||||
let consensus: Arc<dyn Consensus> = if self.dev.dev {
|
let consensus = self.consensus();
|
||||||
debug!(target: "reth::cli", "Using auto seal");
|
|
||||||
Arc::new(AutoSealConsensus::new(Arc::clone(&self.chain)))
|
|
||||||
} else {
|
|
||||||
Arc::new(BeaconConsensus::new(Arc::clone(&self.chain)))
|
|
||||||
};
|
|
||||||
|
|
||||||
self.init_trusted_nodes(&mut config);
|
self.init_trusted_nodes(&mut config);
|
||||||
|
|
||||||
@ -558,6 +553,18 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the [Consensus] instance to use.
|
||||||
|
///
|
||||||
|
/// By default this will be a [BeaconConsensus] instance, but if the `--dev` flag is set, it
|
||||||
|
/// will be an [AutoSealConsensus] instance.
|
||||||
|
pub fn consensus(&self) -> Arc<dyn Consensus> {
|
||||||
|
if self.dev.dev {
|
||||||
|
Arc::new(AutoSealConsensus::new(Arc::clone(&self.chain)))
|
||||||
|
} else {
|
||||||
|
Arc::new(BeaconConsensus::new(Arc::clone(&self.chain)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Constructs a [Pipeline] that's wired to the network
|
/// Constructs a [Pipeline] that's wired to the network
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
async fn build_networked_pipeline<DB, Client>(
|
async fn build_networked_pipeline<DB, Client>(
|
||||||
|
|||||||
Reference in New Issue
Block a user