mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(engine): hooks (#4582)
This commit is contained in:
@ -25,7 +25,10 @@ use eyre::Context;
|
||||
use fdlimit::raise_fd_limit;
|
||||
use futures::{future::Either, pin_mut, stream, stream_select, StreamExt};
|
||||
use reth_auto_seal_consensus::{AutoSealBuilder, AutoSealConsensus, MiningMode};
|
||||
use reth_beacon_consensus::{BeaconConsensus, BeaconConsensusEngine, MIN_BLOCKS_FOR_PIPELINE_RUN};
|
||||
use reth_beacon_consensus::{
|
||||
hooks::{EngineHooks, PruneHook},
|
||||
BeaconConsensus, BeaconConsensusEngine, MIN_BLOCKS_FOR_PIPELINE_RUN,
|
||||
};
|
||||
use reth_blockchain_tree::{
|
||||
config::BlockchainTreeConfig, externals::TreeExternals, BlockchainTree, ShareableBlockchainTree,
|
||||
};
|
||||
@ -446,16 +449,19 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
|
||||
None
|
||||
};
|
||||
|
||||
let pruner = prune_config.map(|prune_config| {
|
||||
let mut hooks = EngineHooks::new();
|
||||
|
||||
if let Some(prune_config) = prune_config {
|
||||
info!(target: "reth::cli", ?prune_config, "Pruner initialized");
|
||||
reth_prune::Pruner::new(
|
||||
let pruner = reth_prune::Pruner::new(
|
||||
db.clone(),
|
||||
self.chain.clone(),
|
||||
prune_config.block_interval,
|
||||
prune_config.parts,
|
||||
self.chain.prune_batch_sizes,
|
||||
)
|
||||
});
|
||||
);
|
||||
hooks.add(PruneHook::new(pruner, Box::new(ctx.task_executor.clone())));
|
||||
}
|
||||
|
||||
// Configure the consensus engine
|
||||
let (beacon_consensus_engine, beacon_engine_handle) = BeaconConsensusEngine::with_channel(
|
||||
@ -471,7 +477,7 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
|
||||
MIN_BLOCKS_FOR_PIPELINE_RUN,
|
||||
consensus_engine_tx,
|
||||
consensus_engine_rx,
|
||||
pruner,
|
||||
hooks,
|
||||
)?;
|
||||
info!(target: "reth::cli", "Consensus engine initialized");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user