From d8df789a7058383176ed1c4447f15cbaa7d6c042 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Wed, 3 Apr 2019 10:13:05 +1100 Subject: [PATCH] simplify get_winning_root logic --- specs/core/0_beacon-chain.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 1032a905a..fa0c97acb 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1761,13 +1761,12 @@ def get_previous_epoch_matching_head_attestations(state: BeaconState) -> List[Pe ```python def get_winning_root_and_participants(state: BeaconState, slot: Slot, shard: Shard) -> Tuple[Bytes32, List[ValidatorIndex]]: - all_attestations = state.current_epoch_attestations + state.previous_epoch_attestations + attestations = state.current_epoch_attestations if slot_to_epoch(slot) == get_current_epoch(state) else state.previous_epoch_attestations crosslinks = state.current_crosslinks if slot_to_epoch(slot) == get_current_epoch(state) else state.previous_crosslinks valid_attestations = [ - a for a in all_attestations - if a.data.previous_crosslink == crosslinks[shard] and - a.data.shard == shard and a.data.slot == slot + a for a in attestations + if a.data.previous_crosslink == crosslinks[shard] and a.data.shard == shard ] all_roots = [a.data.crosslink_data_root for a in valid_attestations]