fix vote/unvote in checkpoint issue

This commit is contained in:
Nguyen Sy Thanh Son 2019-01-08 15:40:36 +00:00
parent d8ac726f30
commit 1c1b833815

View file

@ -859,8 +859,6 @@ func (c *Posv) Finalize(chain consensus.ChainReader, header *types.Header, state
number := header.Number.Uint64()
rCheckpoint := chain.Config().Posv.RewardCheckpoint
_ = c.cacheData(txs, receipts)
if c.HookReward != nil && number%rCheckpoint == 0 {
if !c.EnableCache && int(c.BlockSigners.Len()) >= int(rCheckpoint*3) {
log.Debug("EnableCache true c.BlockSigners.Len() ", "BlockSigners.Len", c.BlockSigners.Len())
@ -882,6 +880,8 @@ func (c *Posv) Finalize(chain consensus.ChainReader, header *types.Header, state
}
}
_ = c.cacheData(txs, receipts)
// the state remains as is and uncles are dropped
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
header.UncleHash = types.CalcUncleHash(nil)