Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions crates/stages/stages/src/stages/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,19 @@ where
// Validation passed, apply unwind changes to the database.
provider.write_trie_updates(&updates)?;

// TODO(alexey): update entities checkpoint
// Update entities checkpoint to reflect the unwind operation
// Since we're unwinding, we need to recalculate the total entities at the target block
let accounts = tx.entries::<tables::HashedAccounts>()?;
let storages = tx.entries::<tables::HashedStorages>()?;
let total = (accounts + storages) as u64;
entities_checkpoint.total = total;
entities_checkpoint.processed = total;
}

Ok(UnwindOutput { checkpoint: StageCheckpoint::new(input.unwind_to) })
Ok(UnwindOutput {
checkpoint: StageCheckpoint::new(input.unwind_to)
.with_entities_stage_checkpoint(entities_checkpoint),
})
}
}

Expand Down