From a9847507072fb93bc2750dbb6040c6baf90c5d97 Mon Sep 17 00:00:00 2001 From: Julian Yap Date: Sat, 28 Jan 2017 19:43:40 -1000 Subject: [PATCH] Fix initial sync issue --- core/state_processor.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/core/state_processor.go b/core/state_processor.go index ca9f787b0d..a02cdbbc11 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -158,12 +158,21 @@ func AccumulateRewards(statedb *state.StateDB, header *types.Header, uncles []*t r.Sub(r, header.Number) r.Mul(r, BlockReward) r.Div(r, big2) - if r.Cmp(big.NewInt(0)) < 0 { - r = big.NewInt(0) - } - statedb.AddBalance(uncle.Coinbase, r) - r.Div(BlockReward, big32) + if header.Number.Cmp(big.NewInt(10)) < 0 { + statedb.AddBalance(uncle.Coinbase, r) + r.Div(BlockReward, big32) + if r.Cmp(big.NewInt(0)) < 0 { + r = big.NewInt(0) + } + } else { + if r.Cmp(big.NewInt(0)) < 0 { + r = big.NewInt(0) + } + statedb.AddBalance(uncle.Coinbase, r) + r.Div(BlockReward, big32) + } + reward.Add(reward, r) } statedb.AddBalance(header.Coinbase, reward)