From 02a962d35dab046e54e437616272146b57d024fb Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Thu, 31 Jan 2019 18:32:23 +1100 Subject: [PATCH] Ensure per_epoch trans. happens before per_slot. --- eth2/types/src/beacon_state/slot_processing.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eth2/types/src/beacon_state/slot_processing.rs b/eth2/types/src/beacon_state/slot_processing.rs index 9501083f04..4693bd0692 100644 --- a/eth2/types/src/beacon_state/slot_processing.rs +++ b/eth2/types/src/beacon_state/slot_processing.rs @@ -16,6 +16,10 @@ impl BeaconState { previous_block_root: Hash256, spec: &ChainSpec, ) -> Result<(), Error> { + if (self.slot + 1) % spec.epoch_length == 0 { + self.per_epoch_processing(spec)?; + } + self.slot += 1; let block_proposer = self.get_beacon_proposer_index(self.slot, spec)?; @@ -32,10 +36,6 @@ impl BeaconState { let root = merkle_root(&self.latest_block_roots[..]); self.batched_block_roots.push(root); } - - if self.slot % spec.epoch_length == 0 { - self.per_epoch_processing(spec)?; - } Ok(()) }