From 02e8e8974049f1965df3f7b0b9b874a46a26c150 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Mon, 4 Mar 2019 19:05:00 -0700 Subject: [PATCH] handle get_base_reward when no previous balance --- specs/core/0_beacon-chain.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 0e836df1f..13eae0432 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -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 ```