Fix initial sync issue

This commit is contained in:
Julian Yap 2017-01-28 19:43:40 -10:00
parent 44472bcdd0
commit a984750707

View file

@ -158,12 +158,21 @@ func AccumulateRewards(statedb *state.StateDB, header *types.Header, uncles []*t
r.Sub(r, header.Number) r.Sub(r, header.Number)
r.Mul(r, BlockReward) r.Mul(r, BlockReward)
r.Div(r, big2) 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) reward.Add(reward, r)
} }
statedb.AddBalance(header.Coinbase, reward) statedb.AddBalance(header.Coinbase, reward)