Delete current epoch vals from ParticipationCache

This commit is contained in:
Michael Sproul
2022-02-18 14:22:25 +11:00
parent 0b171cf097
commit 82bf8a3351
3 changed files with 31 additions and 31 deletions

View File

@@ -486,10 +486,8 @@ impl<T: EthSpec> BeaconState<T> {
/// If the current epoch is the genesis epoch, the genesis_epoch is returned.
pub fn previous_epoch(&self) -> Epoch {
let current_epoch = self.current_epoch();
if current_epoch > T::genesis_epoch() {
current_epoch
.safe_sub(1)
.expect("current epoch greater than genesis implies greater than 0")
if let Ok(prev_epoch) = current_epoch.safe_sub(1) {
prev_epoch
} else {
current_epoch
}