core: fix bug in consensus

We should set MerkleRoot in approving block irrespective to
transactions presented in the block.
This commit is contained in:
Anna Shaleva 2020-05-19 10:47:56 +03:00
parent e8ad09f30d
commit 45b8bdb51c

View file

@ -500,9 +500,7 @@ func newBlockFromContext(ctx *dbft.Context) block.Block {
Nonce: ctx.Nonce,
}
if len(ctx.TransactionHashes) != 0 {
mt := merkle.NewMerkleTree(append([]util.Uint256{consensusData.Hash()}, ctx.TransactionHashes...)...)
block.Block.MerkleRoot = mt.Root().Hash
}
mt := merkle.NewMerkleTree(append([]util.Uint256{consensusData.Hash()}, ctx.TransactionHashes...)...)
block.Block.MerkleRoot = mt.Root().Hash
return block
}