aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain.go
diff options
context:
space:
mode:
authorbojie <bojie@dexon.org>2019-01-16 17:08:56 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:56 +0800
commit430e4cd399e10f45c29212cf8d598a7beb7d4605 (patch)
tree3855a699d71f53e8eb11b55152c4f68bd8ba7a8d /core/blockchain.go
parent60c1661d9f5bc1a15812ead86d7f8d9d4a3da52e (diff)
downloaddexon-430e4cd399e10f45c29212cf8d598a7beb7d4605.tar
dexon-430e4cd399e10f45c29212cf8d598a7beb7d4605.tar.gz
dexon-430e4cd399e10f45c29212cf8d598a7beb7d4605.tar.bz2
dexon-430e4cd399e10f45c29212cf8d598a7beb7d4605.tar.lz
dexon-430e4cd399e10f45c29212cf8d598a7beb7d4605.tar.xz
dexon-430e4cd399e10f45c29212cf8d598a7beb7d4605.tar.zst
dexon-430e4cd399e10f45c29212cf8d598a7beb7d4605.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/blockchain.go')
-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())