add note about total balance overflowing
This commit is contained in:
parent
882b9ee035
commit
1579072e15
|
@ -954,6 +954,7 @@ def get_beacon_proposer_index(state: BeaconState) -> ValidatorIndex:
|
|||
def get_total_balance(state: BeaconState, indices: Set[ValidatorIndex]) -> Gwei:
|
||||
"""
|
||||
Return the combined effective balance of the ``indices``. (1 Gwei minimum to avoid divisions by zero.)
|
||||
Math safe up to ~10B ETH, afterwhich this overflows uint64.
|
||||
"""
|
||||
return Gwei(max(1, sum([state.validators[index].effective_balance for index in indices])))
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue