handle get_base_reward when no previous balance
This commit is contained in:
parent
0fdfbc473e
commit
02e8e89740
|
@ -2171,6 +2171,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
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue