cleanup get_eth1_vote
This commit is contained in:
parent
e7f71886b0
commit
5159c69632
|
@ -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)]
|
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)]
|
all_eth1_data = [get_eth1_data(distance) for distance in range(ETH1_FOLLOW_DISTANCE, previous_eth1_distance)]
|
||||||
|
|
||||||
valid_votes = []
|
period_tail = state.slot % SLOTS_PER_ETH1_VOTING_PERIOD >= integer_squareroot(SLOTS_PER_ETH1_VOTING_PERIOD)
|
||||||
for slot, vote in enumerate(state.eth1_data_votes):
|
if period_tail:
|
||||||
period_tail = slot % SLOTS_PER_ETH1_VOTING_PERIOD >= integer_squareroot(SLOTS_PER_ETH1_VOTING_PERIOD)
|
votes_to_consider = all_eth1_data
|
||||||
if vote in new_eth1_data or (period_tail and vote in all_eth1_data):
|
else:
|
||||||
valid_votes.append(vote)
|
votes_to_consider = new_eth1_data
|
||||||
|
|
||||||
|
valid_votes = [vote for vote in state.eth1_data_votes if vote in votes_to_consider]
|
||||||
|
|
||||||
return max(
|
return max(
|
||||||
valid_votes,
|
valid_votes,
|
||||||
|
|
Loading…
Reference in New Issue