Apply Danny's suggestion
This commit is contained in:
parent
a399d953d3
commit
0d8fab3986
|
@ -181,11 +181,13 @@ def get_latest_attesting_balance(store: Store, root: Root) -> Gwei:
|
||||||
if (i in store.latest_messages
|
if (i in store.latest_messages
|
||||||
and get_ancestor(store, store.latest_messages[i].root, store.blocks[root].slot) == root)
|
and get_ancestor(store, store.latest_messages[i].root, store.blocks[root].slot) == root)
|
||||||
))
|
))
|
||||||
|
if store.proposer_boost_root == Root():
|
||||||
|
# Return only attestation score if ``proposer_boost_root`` is not set
|
||||||
|
return attestation_score
|
||||||
|
# Calculate proposer score if ``proposer_boost_root`` is set
|
||||||
proposer_score = Gwei(0)
|
proposer_score = Gwei(0)
|
||||||
if (
|
# Boost is applied if ``root`` is an ancestor of ``proposer_boost_root``
|
||||||
store.proposer_boost_root != Root()
|
if get_ancestor(store, store.proposer_boost_root, store.blocks[root].slot) == 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)))
|
num_validators = len(get_active_validator_indices(state, get_current_epoch(state)))
|
||||||
avg_balance = get_total_active_balance(state) // num_validators
|
avg_balance = get_total_active_balance(state) // num_validators
|
||||||
committee_size = num_validators // SLOTS_PER_EPOCH
|
committee_size = num_validators // SLOTS_PER_EPOCH
|
||||||
|
|
Loading…
Reference in New Issue