aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorbojie <bojie@dexon.org>2019-01-16 17:08:56 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:21 +0800
commitb784352b70b012f2a6198558c377ca6807a2dcc2 (patch)
treec1e1e382fa74d375078c95bccc1036fd48d211c3 /core
parent4095f8c34043a2418dece4d5affbceffe0ca55da (diff)
downloadgo-tangerine-b784352b70b012f2a6198558c377ca6807a2dcc2.tar.gz
go-tangerine-b784352b70b012f2a6198558c377ca6807a2dcc2.tar.zst
go-tangerine-b784352b70b012f2a6198558c377ca6807a2dcc2.zip
app: fix reward bug with empty block (#155)
* app: fix reward bug with empty block * make block generation consistent * revert change to dmoment in genesis.json
Diffstat (limited to 'core')
-rw-r--r--core/blockchain.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index 6aee356d2..e6d7cdc76 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -1959,13 +1959,12 @@ func (bc *BlockChain) ProcessEmptyBlock(block *types.Block) (*common.Hash, error
}
header.ParentHash = parentBlock.Hash()
- header.GasUsed = 0
- header.Root = currentState.IntermediateRoot(true)
+ 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")
}
- newBlock := types.NewBlock(header, nil, nil, nil)
root := newBlock.Root()
if _, ok := bc.GetRoundHeight(newBlock.Round()); !ok {
bc.storeRoundHeight(newBlock.Round(), newBlock.NumberU64())