Found by Cem Özer: Ignore older latest messages in attesting balance sum, instead of assertion error

This commit is contained in:
protolambda 2019-07-20 02:13:31 +02:00
parent 452ecf8e27
commit 01af304403
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
1 changed files with 6 additions and 2 deletions

View File

@ -101,8 +101,12 @@ def get_genesis_store(genesis_state: BeaconState) -> Store:
```python
def get_ancestor(store: Store, root: Hash, slot: Slot) -> Hash:
block = store.blocks[root]
assert block.slot >= slot
return root if block.slot == slot else get_ancestor(store, block.parent_root, slot)
if block.slot > 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`