Skip to content

Commit 00f1733

Browse files
fix: Set Era pipeline stage to last checkpoint when there is no target (#19000)
1 parent 06b33fd commit 00f1733

File tree

1 file changed

+8
-2
lines changed
  • crates/stages/stages/src/stages

1 file changed

+8
-2
lines changed

crates/stages/stages/src/stages/era.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,16 @@ where
211211

212212
height
213213
} else {
214-
input.target()
214+
// It's possible for a pipeline sync to be executed with a None target, e.g. after a
215+
// stage was manually dropped, and `reth node` is then called without a `--debug.tip`.
216+
//
217+
// In this case we don't want to simply default to zero, as that would overwrite the
218+
// previously stored checkpoint block number. Instead we default to that previous
219+
// checkpoint.
220+
input.target.unwrap_or_else(|| input.checkpoint().block_number)
215221
};
216222

217-
Ok(ExecOutput { checkpoint: StageCheckpoint::new(height), done: height == input.target() })
223+
Ok(ExecOutput { checkpoint: StageCheckpoint::new(height), done: height >= input.target() })
218224
}
219225

220226
fn unwind(

0 commit comments

Comments
 (0)