fix(commands): prevents potential arithmetic underflow in debug commands (#8883)

This commit is contained in:
HAPPY
2024-06-17 19:52:11 +08:00
committed by GitHub
parent 34d697eb1f
commit 4207540974

View File

@@ -167,7 +167,9 @@ impl Command {
OriginalValuesKnown::Yes,
)?;
let checkpoint = Some(StageCheckpoint::new(block_number - 1));
let checkpoint = Some(StageCheckpoint::new(
block_number.checked_sub(1).ok_or(eyre::eyre!("GenesisBlockHasNoParent"))?,
));
let mut account_hashing_done = false;
while !account_hashing_done {