Update previous epoch function
This commit is contained in:
parent
b79f0cdf68
commit
f83d02b394
@ -203,7 +203,12 @@ impl BeaconState {
|
||||
///
|
||||
/// Spec v0.2.0
|
||||
pub fn previous_epoch(&self, spec: &ChainSpec) -> Epoch {
|
||||
self.current_epoch(spec).saturating_sub(1_u64)
|
||||
let current_epoch = self.current_epoch(&spec);
|
||||
if current_epoch == spec.genesis_epoch {
|
||||
current_epoch
|
||||
} else {
|
||||
current_epoch - 1
|
||||
}
|
||||
}
|
||||
|
||||
/// The epoch following `self.current_epoch()`.
|
||||
|
Loading…
Reference in New Issue
Block a user