mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: remove HeaderSyncMode::Continuous & debug.continuous (#8714)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de> Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>
This commit is contained in:
@ -240,7 +240,6 @@ where
|
||||
task_spawner: Box<dyn TaskSpawner>,
|
||||
sync_state_updater: Box<dyn NetworkSyncUpdater>,
|
||||
max_block: Option<BlockNumber>,
|
||||
run_pipeline_continuously: bool,
|
||||
payload_builder: PayloadBuilderHandle<EngineT>,
|
||||
target: Option<B256>,
|
||||
pipeline_run_threshold: u64,
|
||||
@ -254,7 +253,6 @@ where
|
||||
task_spawner,
|
||||
sync_state_updater,
|
||||
max_block,
|
||||
run_pipeline_continuously,
|
||||
payload_builder,
|
||||
target,
|
||||
pipeline_run_threshold,
|
||||
@ -285,7 +283,6 @@ where
|
||||
task_spawner: Box<dyn TaskSpawner>,
|
||||
sync_state_updater: Box<dyn NetworkSyncUpdater>,
|
||||
max_block: Option<BlockNumber>,
|
||||
run_pipeline_continuously: bool,
|
||||
payload_builder: PayloadBuilderHandle<EngineT>,
|
||||
target: Option<B256>,
|
||||
pipeline_run_threshold: u64,
|
||||
@ -299,7 +296,6 @@ where
|
||||
pipeline,
|
||||
client,
|
||||
task_spawner.clone(),
|
||||
run_pipeline_continuously,
|
||||
max_block,
|
||||
blockchain.chain_spec(),
|
||||
event_sender.clone(),
|
||||
@ -1448,11 +1444,6 @@ where
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
// update the canon chain if continuous is enabled
|
||||
if self.sync.run_pipeline_continuously() {
|
||||
self.set_canonical_head(ctrl.block_number().unwrap_or_default())?;
|
||||
}
|
||||
|
||||
let sync_target_state = match self.forkchoice_state_tracker.sync_target_state() {
|
||||
Some(current_state) => current_state,
|
||||
None => {
|
||||
|
||||
@ -54,8 +54,6 @@ where
|
||||
/// Buffered blocks from downloads - this is a min-heap of blocks, using the block number for
|
||||
/// ordering. This means the blocks will be popped from the heap with ascending block numbers.
|
||||
range_buffered_blocks: BinaryHeap<Reverse<OrderedSealedBlock>>,
|
||||
/// If enabled, the pipeline will be triggered continuously, as soon as it becomes idle
|
||||
run_pipeline_continuously: bool,
|
||||
/// Max block after which the consensus engine would terminate the sync. Used for debugging
|
||||
/// purposes.
|
||||
max_block: Option<BlockNumber>,
|
||||
@ -73,7 +71,6 @@ where
|
||||
pipeline: Pipeline<DB>,
|
||||
client: Client,
|
||||
pipeline_task_spawner: Box<dyn TaskSpawner>,
|
||||
run_pipeline_continuously: bool,
|
||||
max_block: Option<BlockNumber>,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
event_sender: EventSender<BeaconConsensusEngineEvent>,
|
||||
@ -89,7 +86,6 @@ where
|
||||
inflight_full_block_requests: Vec::new(),
|
||||
inflight_block_range_requests: Vec::new(),
|
||||
range_buffered_blocks: BinaryHeap::new(),
|
||||
run_pipeline_continuously,
|
||||
event_sender,
|
||||
max_block,
|
||||
metrics: EngineSyncMetrics::default(),
|
||||
@ -122,11 +118,6 @@ where
|
||||
self.update_block_download_metrics();
|
||||
}
|
||||
|
||||
/// Returns whether or not the sync controller is set to run the pipeline continuously.
|
||||
pub(crate) const fn run_pipeline_continuously(&self) -> bool {
|
||||
self.run_pipeline_continuously
|
||||
}
|
||||
|
||||
/// Returns `true` if a pipeline target is queued and will be triggered on the next `poll`.
|
||||
#[allow(dead_code)]
|
||||
pub(crate) const fn is_pipeline_sync_pending(&self) -> bool {
|
||||
@ -271,20 +262,14 @@ where
|
||||
fn try_spawn_pipeline(&mut self) -> Option<EngineSyncEvent> {
|
||||
match &mut self.pipeline_state {
|
||||
PipelineState::Idle(pipeline) => {
|
||||
let target = self.pending_pipeline_target.take();
|
||||
|
||||
if target.is_none() && !self.run_pipeline_continuously {
|
||||
// nothing to sync
|
||||
return None
|
||||
}
|
||||
|
||||
let target = self.pending_pipeline_target.take()?;
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
let pipeline = pipeline.take().expect("exists");
|
||||
self.pipeline_task_spawner.spawn_critical_blocking(
|
||||
"pipeline task",
|
||||
Box::pin(async move {
|
||||
let result = pipeline.run_as_fut(target).await;
|
||||
let result = pipeline.run_as_fut(Some(target)).await;
|
||||
let _ = tx.send(result);
|
||||
}),
|
||||
);
|
||||
@ -294,7 +279,7 @@ where
|
||||
// outdated (included in the range the pipeline is syncing anyway)
|
||||
self.clear_block_download_requests();
|
||||
|
||||
Some(EngineSyncEvent::PipelineStarted(target))
|
||||
Some(EngineSyncEvent::PipelineStarted(Some(target)))
|
||||
}
|
||||
PipelineState::Running(_) => None,
|
||||
}
|
||||
@ -550,8 +535,6 @@ mod tests {
|
||||
pipeline,
|
||||
client,
|
||||
Box::<TokioTaskExecutor>::default(),
|
||||
// run_pipeline_continuously: false here until we want to test this
|
||||
false,
|
||||
self.max_block,
|
||||
chain_spec,
|
||||
Default::default(),
|
||||
|
||||
@ -25,7 +25,7 @@ use reth_payload_builder::test_utils::spawn_test_payload_service;
|
||||
use reth_primitives::{BlockNumber, ChainSpec, B256};
|
||||
use reth_provider::{
|
||||
providers::BlockchainProvider, test_utils::create_test_provider_factory_with_chain_spec,
|
||||
ExecutionOutcome, HeaderSyncMode,
|
||||
ExecutionOutcome,
|
||||
};
|
||||
use reth_prune::Pruner;
|
||||
use reth_prune_types::PruneModes;
|
||||
@ -371,7 +371,7 @@ where
|
||||
|
||||
Pipeline::builder().add_stages(DefaultStages::new(
|
||||
provider_factory.clone(),
|
||||
HeaderSyncMode::Tip(tip_rx.clone()),
|
||||
tip_rx.clone(),
|
||||
Arc::clone(&consensus),
|
||||
header_downloader,
|
||||
body_downloader,
|
||||
@ -418,7 +418,6 @@ where
|
||||
Box::<TokioTaskExecutor>::default(),
|
||||
Box::<NoopSyncStateUpdater>::default(),
|
||||
None,
|
||||
false,
|
||||
payload_builder,
|
||||
None,
|
||||
self.base_config.pipeline_run_threshold.unwrap_or(MIN_BLOCKS_FOR_PIPELINE_RUN),
|
||||
|
||||
Reference in New Issue
Block a user