diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-27 13:17:22 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:58 +0800 |
commit | 4e0fc985b66e584177572481dfe9e21858a7711c (patch) | |
tree | 8181f47271e60a324e3753d8c2cab64366c48479 | |
parent | 78b707cebf4b3bc101e0793f14f9cac7323bff04 (diff) | |
download | dexon-4e0fc985b66e584177572481dfe9e21858a7711c.tar.gz dexon-4e0fc985b66e584177572481dfe9e21858a7711c.tar.zst dexon-4e0fc985b66e584177572481dfe9e21858a7711c.zip |
core: fix finalize logic (#302)
-rw-r--r-- | consensus/dexcon/dexcon.go | 6 | ||||
-rw-r--r-- | core/blockchain.go | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/consensus/dexcon/dexcon.go b/consensus/dexcon/dexcon.go index 0b6fa192f..4e474bfa3 100644 --- a/consensus/dexcon/dexcon.go +++ b/consensus/dexcon/dexcon.go @@ -208,8 +208,10 @@ func (d *Dexcon) Finalize(chain consensus.ChainReader, header *types.Header, sta gs.MiningHalved() } - // Record last proposed height. - gs.PutLastProposedHeight(header.Coinbase, header.Number) + if header.Coinbase != (common.Address{}) { + // Record last proposed height. + gs.PutLastProposedHeight(header.Coinbase, header.Number) + } header.Root = state.IntermediateRoot(true) return types.NewBlock(header, txs, uncles, receipts), nil diff --git a/core/blockchain.go b/core/blockchain.go index 7a695ac38..3f0e7203e 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1827,10 +1827,6 @@ func (bc *BlockChain) ProcessEmptyBlock(block *types.Block) (*common.Hash, error header.ParentHash = parentBlock.Hash() newBlock, err := bc.engine.Finalize(bc, header, currentState, nil, nil, nil) - if header.Root != parentBlock.Root() { - return nil, fmt.Errorf("empty block state root must same as parent") - } - root := newBlock.Root() if _, ok := bc.GetRoundHeight(newBlock.Round()); !ok { bc.storeRoundHeight(newBlock.Round(), newBlock.NumberU64()) |