mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
fix: drive pipeline forever in debug.continuous (#2375)
Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
This commit is contained in:
@@ -146,6 +146,9 @@ where
|
||||
/// Max block after which the consensus engine would terminate the sync. Used for debugging
|
||||
/// purposes.
|
||||
max_block: Option<BlockNumber>,
|
||||
/// If true, the engine will run the pipeline continuously, regardless of whether or not there
|
||||
/// is a new fork choice state.
|
||||
continuous: bool,
|
||||
/// The payload store.
|
||||
payload_builder: PayloadBuilderHandle,
|
||||
/// Consensus engine metrics.
|
||||
@@ -166,6 +169,7 @@ where
|
||||
pipeline: Pipeline<DB, U>,
|
||||
blockchain_tree: BT,
|
||||
max_block: Option<BlockNumber>,
|
||||
continuous: bool,
|
||||
payload_builder: PayloadBuilderHandle,
|
||||
) -> (Self, BeaconConsensusEngineHandle) {
|
||||
let (to_engine, rx) = mpsc::unbounded_channel();
|
||||
@@ -175,6 +179,7 @@ where
|
||||
pipeline,
|
||||
blockchain_tree,
|
||||
max_block,
|
||||
continuous,
|
||||
payload_builder,
|
||||
to_engine,
|
||||
rx,
|
||||
@@ -190,6 +195,7 @@ where
|
||||
pipeline: Pipeline<DB, U>,
|
||||
blockchain_tree: BT,
|
||||
max_block: Option<BlockNumber>,
|
||||
continuous: bool,
|
||||
payload_builder: PayloadBuilderHandle,
|
||||
to_engine: UnboundedSender<BeaconEngineMessage>,
|
||||
rx: UnboundedReceiver<BeaconEngineMessage>,
|
||||
@@ -205,6 +211,7 @@ where
|
||||
forkchoice_state: None,
|
||||
next_action: BeaconEngineAction::None,
|
||||
max_block,
|
||||
continuous,
|
||||
payload_builder,
|
||||
metrics: Metrics::default(),
|
||||
};
|
||||
@@ -421,13 +428,21 @@ where
|
||||
forkchoice_state: ForkchoiceState,
|
||||
) -> PipelineState<DB, U> {
|
||||
let next_action = std::mem::take(&mut self.next_action);
|
||||
if let BeaconEngineAction::RunPipeline(target) = next_action {
|
||||
|
||||
let (tip, should_run_pipeline) = match next_action {
|
||||
BeaconEngineAction::RunPipeline(target) => {
|
||||
let tip = match target {
|
||||
PipelineTarget::Head => forkchoice_state.head_block_hash,
|
||||
PipelineTarget::Safe => forkchoice_state.safe_block_hash,
|
||||
};
|
||||
(Some(tip), true)
|
||||
}
|
||||
BeaconEngineAction::None => (None, self.continuous),
|
||||
};
|
||||
|
||||
if should_run_pipeline {
|
||||
self.metrics.pipeline_runs.increment(1);
|
||||
let tip = match target {
|
||||
PipelineTarget::Head => forkchoice_state.head_block_hash,
|
||||
PipelineTarget::Safe => forkchoice_state.safe_block_hash,
|
||||
};
|
||||
trace!(target: "consensus::engine", ?tip, "Starting the pipeline");
|
||||
trace!(target: "consensus::engine", ?tip, continuous = tip.is_none(), "Starting the pipeline");
|
||||
let (tx, rx) = oneshot::channel();
|
||||
let db = self.db.clone();
|
||||
self.task_spawner.spawn_critical_blocking(
|
||||
@@ -748,6 +763,7 @@ mod tests {
|
||||
pipeline,
|
||||
tree,
|
||||
None,
|
||||
false,
|
||||
payload_builder,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user