aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-27 13:17:22 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 13:50:05 +0800
commitf500ef0a50518133ef679f7d3f9c41d8d11bcbf5 (patch)
treee19fd9bbfc66f82deb10b30fa0ff758de9e6fbf2
parent23714b346a9d32e8bfcc53c119ccaadd937c92ea (diff)
downloaddexon-f500ef0a50518133ef679f7d3f9c41d8d11bcbf5.tar.gz
dexon-f500ef0a50518133ef679f7d3f9c41d8d11bcbf5.tar.zst
dexon-f500ef0a50518133ef679f7d3f9c41d8d11bcbf5.zip
core: fix finalize logic (#302)
-rw-r--r--consensus/dexcon/dexcon.go6
-rw-r--r--core/blockchain.go4
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())