From 5159c69632a86f63c50abd0516ca5d8548dc7069 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Thu, 7 Nov 2019 12:15:56 -0700 Subject: [PATCH] cleanup get_eth1_vote --- specs/validator/0_beacon-chain-validator.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/specs/validator/0_beacon-chain-validator.md b/specs/validator/0_beacon-chain-validator.md index f6c3b55da..a985047b6 100644 --- a/specs/validator/0_beacon-chain-validator.md +++ b/specs/validator/0_beacon-chain-validator.md @@ -236,11 +236,13 @@ def get_eth1_vote(state: BeaconState, previous_eth1_distance: uint64) -> Eth1Dat new_eth1_data = [get_eth1_data(distance) for distance in range(ETH1_FOLLOW_DISTANCE, 2 * ETH1_FOLLOW_DISTANCE)] all_eth1_data = [get_eth1_data(distance) for distance in range(ETH1_FOLLOW_DISTANCE, previous_eth1_distance)] - valid_votes = [] - for slot, vote in enumerate(state.eth1_data_votes): - period_tail = slot % SLOTS_PER_ETH1_VOTING_PERIOD >= integer_squareroot(SLOTS_PER_ETH1_VOTING_PERIOD) - if vote in new_eth1_data or (period_tail and vote in all_eth1_data): - valid_votes.append(vote) + period_tail = state.slot % SLOTS_PER_ETH1_VOTING_PERIOD >= integer_squareroot(SLOTS_PER_ETH1_VOTING_PERIOD) + if period_tail: + votes_to_consider = all_eth1_data + else: + votes_to_consider = new_eth1_data + + valid_votes = [vote for vote in state.eth1_data_votes if vote in votes_to_consider] return max( valid_votes,