only update justified epoch/root if changed

This commit is contained in:
Danny Ryan 2019-03-11 18:23:17 -06:00
parent f06a3b82e7
commit 3916643ef6
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 3 additions and 2 deletions

View File

@ -1835,8 +1835,9 @@ def update_justification_and_finalization(state: BeaconState) -> None:
# Rotate justified epochs
state.previous_justified_epoch = state.justified_epoch
state.previous_justified_root = state.justified_root
state.justified_epoch = new_justified_epoch
state.justified_root = get_block_root(state, get_epoch_start_slot(new_justified_epoch))
if new_justified_epoch != state.justified_epoch:
state.justified_epoch = new_justified_epoch
state.justified_root = get_block_root(state, get_epoch_start_slot(new_justified_epoch))
```
#### Crosslinks