mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-26 01:05:15 +00:00
Merge branch 'vbuterin-patch-7' of github.com:ethereum/eth2.0-specs into vbuterin-patch-7
This commit is contained in:
commit
0f274a906c
@ -2056,12 +2056,16 @@ def get_winning_root_and_participants(state: BeaconState, shard: Shard) -> Tuple
|
|||||||
a for a in all_attestations if a.data.latest_crosslink == state.latest_crosslinks[shard]
|
a for a in all_attestations if a.data.latest_crosslink == state.latest_crosslinks[shard]
|
||||||
]
|
]
|
||||||
all_roots = [a.data.crosslink_data_root for a in valid_attestations]
|
all_roots = [a.data.crosslink_data_root for a in valid_attestations]
|
||||||
|
|
||||||
|
# handle when no attestations for shard available
|
||||||
|
if len(all_roots) == 0:
|
||||||
|
return ZERO_HASH, []
|
||||||
|
|
||||||
def get_attestations_for(root) -> List[PendingAttestation]:
|
def get_attestations_for(root) -> List[PendingAttestation]:
|
||||||
return [a for a in valid_attestations if a.data.crosslink_data_root == root]
|
return [a for a in valid_attestations if a.data.crosslink_data_root == root]
|
||||||
|
|
||||||
winning_root = max(all_roots, key=lambda r: get_attesting_balance(state, get_attestations_for(r)))
|
winning_root = max(all_roots, key=lambda r: get_attesting_balance(state, get_attestations_for(r)))
|
||||||
|
|
||||||
return winning_root, get_attesting_indices(state, get_attestations_for(winning_root))
|
return winning_root, get_attesting_indices(state, get_attestations_for(winning_root))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user