mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-30 01:28:21 -05:00
fix(consensus-engine): handle pipeline unwind (#1938)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 { .. })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user