one more rootslot fix

This commit is contained in:
Danny Ryan 2019-06-20 14:57:53 -06:00
parent c5143ccefa
commit fb9a5f0bc5
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 2 additions and 1 deletions

View File

@ -157,7 +157,8 @@ def on_block(store: Store, block: BeaconBlock) -> None:
# Check that block is later than the finalized epoch slot # Check that block is later than the finalized epoch slot
assert blocks.slot > get_epoch_start_slot(store.finalized_epoch) assert blocks.slot > get_epoch_start_slot(store.finalized_epoch)
# Check block slot against Unix time # Check block slot against Unix time
pre_state = deepcopy(store.states[block.parent_root]) parent_block = store.blocks[block.parent_root]
pre_state = deepcopy(store.states[RootSlot(signing_root(parent_block), parent_block.slot)])
assert store.time >= pre_state.genesis_time + block.slot * SECONDS_PER_SLOT assert store.time >= pre_state.genesis_time + block.slot * SECONDS_PER_SLOT
# Check the block is valid and compute the post-state # Check the block is valid and compute the post-state
state = state_transition(pre_state, block) state = state_transition(pre_state, block)