diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 526443baed..7fe49ad0e7 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -321,12 +321,17 @@ where } match result { - Ok(_) => { - // Terminate the sync early if it's reached the maximum user - // configured block. - let minimum_pipeline_progress = *pipeline.minimum_progress(); - if this.has_reached_max_block(minimum_pipeline_progress) { - return Poll::Ready(Ok(())) + Ok(ctrl) => { + if ctrl.is_unwind() { + this.require_pipeline_run(PipelineTarget::Head); + } else { + // Terminate the sync early if it's reached the maximum user + // configured block. + let minimum_pipeline_progress = + *pipeline.minimum_progress(); + if this.has_reached_max_block(minimum_pipeline_progress) { + return Poll::Ready(Ok(())) + } } } // Any pipeline error at this point is fatal. diff --git a/crates/stages/src/pipeline/ctrl.rs b/crates/stages/src/pipeline/ctrl.rs index d250c95d06..ee712cdfd0 100644 --- a/crates/stages/src/pipeline/ctrl.rs +++ b/crates/stages/src/pipeline/ctrl.rs @@ -25,4 +25,8 @@ impl ControlFlow { pub fn should_continue(&self) -> bool { matches!(self, ControlFlow::Continue { .. } | ControlFlow::NoProgress { .. }) } + + pub fn is_unwind(&self) -> bool { + matches!(self, ControlFlow::Unwind { .. }) + } }