Simplify balance calc in `process_sync_committee`

This commit is contained in:
Michael Sproul 2021-03-31 17:20:19 +11:00
parent a465f21deb
commit e8b758f9a6
No known key found for this signature in database
GPG Key ID: 77B1309D2E54E914
1 changed files with 1 additions and 2 deletions

View File

@ -545,8 +545,7 @@ def process_sync_committee(state: BeaconState, aggregate: SyncAggregate) -> None
max_slot_rewards = Gwei(max_epoch_rewards * len(included_indices) // len(committee_indices) // SLOTS_PER_EPOCH) max_slot_rewards = Gwei(max_epoch_rewards * len(included_indices) // len(committee_indices) // SLOTS_PER_EPOCH)
# Compute the participant and proposer sync rewards # Compute the participant and proposer sync rewards
committee_effective_balance = sum([state.validators[index].effective_balance for index in included_indices]) committee_effective_balance = get_total_balance(state, included_indices)
committee_effective_balance = max(EFFECTIVE_BALANCE_INCREMENT, committee_effective_balance)
for included_index in included_indices: for included_index in included_indices:
effective_balance = state.validators[included_index].effective_balance effective_balance = state.validators[included_index].effective_balance
inclusion_reward = Gwei(max_slot_rewards * effective_balance // committee_effective_balance) inclusion_reward = Gwei(max_slot_rewards * effective_balance // committee_effective_balance)