Merge pull request #1306 from ethereum/old_latest_message

Found by Cem Özer: Ignore older latest messages in attesting balance
This commit is contained in:
Danny Ryan 2019-07-24 20:03:23 -06:00 committed by GitHub
commit f9f722c505
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,8 +91,12 @@ def get_genesis_store(genesis_state: BeaconState) -> Store:
```python ```python
def get_ancestor(store: Store, root: Hash, slot: Slot) -> Hash: def get_ancestor(store: Store, root: Hash, slot: Slot) -> Hash:
block = store.blocks[root] block = store.blocks[root]
assert block.slot >= slot if block.slot > slot:
return root if block.slot == slot else get_ancestor(store, block.parent_root, slot) return get_ancestor(store, block.parent_root, slot)
elif block.slot == slot:
return root
else:
return Bytes32() # root is older than queried slot: no results.
``` ```
#### `get_latest_attesting_balance` #### `get_latest_attesting_balance`