mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-02 12:44:59 -05:00
Merge pull request #718 from ethereum/empty-base-reward
handle get_base_reward when no previous balance
This commit is contained in:
@@ -2169,6 +2169,9 @@ First, we define some additional helpers:
|
||||
|
||||
```python
|
||||
def get_base_reward(state: BeaconState, index: ValidatorIndex) -> Gwei:
|
||||
if get_previous_total_balance(state) == 0:
|
||||
return 0
|
||||
|
||||
adjusted_quotient = integer_squareroot(get_previous_total_balance(state)) // BASE_REWARD_QUOTIENT
|
||||
return get_effective_balance(state, index) // adjusted_quotient // 5
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user