mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-01 23:25:22 -05:00
Apply HWW's suggestion
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
This commit is contained in:
@@ -182,13 +182,15 @@ def get_latest_attesting_balance(store: Store, root: Root) -> Gwei:
|
||||
and get_ancestor(store, store.latest_messages[i].root, store.blocks[root].slot) == root)
|
||||
))
|
||||
proposer_score = Gwei(0)
|
||||
if store.proposer_boost_root != Root():
|
||||
if get_ancestor(store, store.proposer_boost_root, store.blocks[root].slot) == root:
|
||||
num_validators = len(get_active_validator_indices(state, get_current_epoch(state)))
|
||||
avg_balance = get_total_active_balance(state) // num_validators
|
||||
committee_size = num_validators // SLOTS_PER_EPOCH
|
||||
committee_weight = committee_size * avg_balance
|
||||
proposer_score = (committee_weight * PROPOSER_SCORE_BOOST) // 100
|
||||
if (
|
||||
store.proposer_boost_root != Root()
|
||||
and get_ancestor(store, store.proposer_boost_root, store.blocks[root].slot) == root
|
||||
):
|
||||
num_validators = len(get_active_validator_indices(state, get_current_epoch(state)))
|
||||
avg_balance = get_total_active_balance(state) // num_validators
|
||||
committee_size = num_validators // SLOTS_PER_EPOCH
|
||||
committee_weight = committee_size * avg_balance
|
||||
proposer_score = (committee_weight * PROPOSER_SCORE_BOOST) // 100
|
||||
return attestation_score + proposer_score
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user