fix assert conditions in get_block_hash

This commit is contained in:
Danny Ryan 2018-12-18 12:53:48 -06:00
parent 0de7240452
commit 36e26c86a3
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A

View File

@ -902,7 +902,8 @@ def get_block_root(state: BeaconState,
"""
Returns the block root at a recent ``slot``.
"""
assert slot > state.slot - LATEST_BLOCK_ROOTS_LENGTH
assert state.slot <= slot + LATEST_BLOCK_ROOTS_LENGTH
assert slot < state.slot
return state.latest_block_roots[slot % LATEST_BLOCK_ROOTS_LENGTH]
```