fix(prune): saturating subtract for genesis deposit contract block (#9584)

This commit is contained in:
Alexey Shekhirin
2024-07-17 20:01:55 +01:00
committed by GitHub
parent 0376be622d
commit 5cd22b50e8

View File

@ -40,7 +40,9 @@ impl PruneMode {
}
Self::Before(n) if *n == tip + 1 && purpose.is_static_file() => Some((tip, *self)),
Self::Before(n) if *n > tip => None, // Nothing to prune yet
Self::Before(n) if tip - n >= segment.min_blocks(purpose) => Some((n - 1, *self)),
Self::Before(n) if tip - n >= segment.min_blocks(purpose) => {
Some(((*n).saturating_sub(1), *self))
}
_ => return Err(PruneSegmentError::Configuration(segment)),
};
Ok(result)