diff --git a/crates/ethereum/node/src/launch.rs b/crates/ethereum/node/src/launch.rs
index c2f36f619e..d2278699e3 100644
--- a/crates/ethereum/node/src/launch.rs
+++ b/crates/ethereum/node/src/launch.rs
@@ -160,8 +160,6 @@ where
let pipeline_events = pipeline.events();
- let initial_target = ctx.node_config().debug.tip;
-
let mut pruner_builder = ctx.pruner_builder();
if let Some(exex_manager_handle) = &exex_manager_handle {
pruner_builder =
@@ -251,6 +249,7 @@ where
.await?;
// Run consensus engine to completion
+ let initial_target = ctx.initial_backfill_target()?;
let network_handle = ctx.components().network().clone();
let chainspec = ctx.chain_spec();
let (exit, rx) = oneshot::channel();
diff --git a/crates/node/builder/src/launch/common.rs b/crates/node/builder/src/launch/common.rs
index 66f620e53d..21a6e7219e 100644
--- a/crates/node/builder/src/launch/common.rs
+++ b/crates/node/builder/src/launch/common.rs
@@ -37,13 +37,13 @@ use reth_node_metrics::{
use reth_primitives::{BlockNumber, Head, B256};
use reth_provider::{
providers::{BlockchainProvider, BlockchainProvider2, StaticFileProvider},
- CanonStateNotificationSender, FullProvider, ProviderFactory, StaticFileProviderFactory,
- TreeViewer,
+ BlockHashReader, CanonStateNotificationSender, FullProvider, ProviderFactory, ProviderResult,
+ StageCheckpointReader, StaticFileProviderFactory, TreeViewer,
};
use reth_prune::{PruneModes, PrunerBuilder};
use reth_rpc_builder::config::RethRpcServerConfig;
use reth_rpc_layer::JwtSecret;
-use reth_stages::{sets::DefaultStages, MetricEvent, Pipeline, PipelineTarget};
+use reth_stages::{sets::DefaultStages, MetricEvent, Pipeline, PipelineTarget, StageId};
use reth_static_file::StaticFileProducer;
use reth_tasks::TaskExecutor;
use reth_tracing::tracing::{debug, error, info, warn};
@@ -759,6 +759,67 @@ where
&self.right().blockchain_db
}
+ /// Returns the initial backfill to sync to at launch.
+ ///
+ /// This returns the configured `debug.tip` if set, otherwise it will check if backfill was
+ /// previously interrupted and returns the block hash of the last checkpoint, see also
+ /// [`Self::check_pipeline_consistency`]
+ pub fn initial_backfill_target(&self) -> ProviderResult