mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(stages): checkpoint hashing stages into a new table (#2735)
This commit is contained in:
@ -138,6 +138,40 @@ impl StageCheckpoint {
|
||||
pub fn new(block_number: BlockNumber) -> Self {
|
||||
Self { block_number, ..Default::default() }
|
||||
}
|
||||
|
||||
/// Returns the account hashing stage checkpoint, if any.
|
||||
pub fn account_hashing_stage_checkpoint(&self) -> Option<AccountHashingCheckpoint> {
|
||||
match self.stage_checkpoint {
|
||||
Some(StageUnitCheckpoint::Account(checkpoint)) => Some(checkpoint),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the storage hashing stage checkpoint, if any.
|
||||
pub fn storage_hashing_stage_checkpoint(&self) -> Option<StorageHashingCheckpoint> {
|
||||
match self.stage_checkpoint {
|
||||
Some(StageUnitCheckpoint::Storage(checkpoint)) => Some(checkpoint),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the stage checkpoint to account hashing.
|
||||
pub fn with_account_hashing_stage_checkpoint(
|
||||
mut self,
|
||||
checkpoint: AccountHashingCheckpoint,
|
||||
) -> Self {
|
||||
self.stage_checkpoint = Some(StageUnitCheckpoint::Account(checkpoint));
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the stage checkpoint to storage hashing.
|
||||
pub fn with_storage_hashing_stage_checkpoint(
|
||||
mut self,
|
||||
checkpoint: StorageHashingCheckpoint,
|
||||
) -> Self {
|
||||
self.stage_checkpoint = Some(StageUnitCheckpoint::Storage(checkpoint));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(alexey): ideally, we'd want to display block number + stage-specific metric (if available)
|
||||
|
||||
Reference in New Issue
Block a user