From 9659b81ee1bf27f979b5f0793778ff97e2fc62b6 Mon Sep 17 00:00:00 2001 From: Pierre <974741468@qq.com> Date: Thu, 24 Dec 2020 04:15:38 +0800 Subject: [PATCH] x/evm: set blockHash when executing function CommitStateDB.Prepare in handler (#666) --- x/evm/handler.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/x/evm/handler.go b/x/evm/handler.go index f1615f679..9b99e2bf3 100644 --- a/x/evm/handler.go +++ b/x/evm/handler.go @@ -63,8 +63,8 @@ func handleMsgEthereumTx(ctx sdk.Context, k Keeper, msg types.MsgEthereumTx) (*s // other nodes, causing a consensus error if !st.Simulate { // Prepare db for logs - // TODO: block hash - k.CommitStateDB.Prepare(ethHash, common.Hash{}, k.TxCount) + blockHash := types.HashFromContext(ctx) + k.CommitStateDB.Prepare(ethHash, blockHash, k.TxCount) k.TxCount++ } @@ -149,7 +149,8 @@ func handleMsgEthermint(ctx sdk.Context, k Keeper, msg types.MsgEthermint) (*sdk if !st.Simulate { // Prepare db for logs - k.CommitStateDB.Prepare(ethHash, common.Hash{}, k.TxCount) + blockHash := types.HashFromContext(ctx) + k.CommitStateDB.Prepare(ethHash, blockHash, k.TxCount) k.TxCount++ }