diff --git a/crates/storage/provider/src/providers/database/provider.rs b/crates/storage/provider/src/providers/database/provider.rs index 2d494c40e2..597909db4c 100644 --- a/crates/storage/provider/src/providers/database/provider.rs +++ b/crates/storage/provider/src/providers/database/provider.rs @@ -1227,14 +1227,15 @@ impl<'this, TX: DbTxMut<'this>> StageCheckpointWriter for DatabaseProvider<'this ) -> Result<()> { // iterate over all existing stages in the table and update its progress. let mut cursor = self.tx.cursor_write::()?; - while let Some((stage_name, checkpoint)) = cursor.next()? { + for stage_id in StageId::ALL { + let (_, checkpoint) = cursor.seek_exact(stage_id.to_string())?.unwrap_or_default(); cursor.upsert( - stage_name, + stage_id.to_string(), StageCheckpoint { block_number, ..if drop_stage_checkpoint { Default::default() } else { checkpoint } }, - )? + )?; } Ok(())