diff --git a/core/state_transition.go b/core/state_transition.go index fb03c48aab..e96b99de50 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -281,8 +281,7 @@ func (st *StateTransition) preCheck() error { msg.From.Hex(), stNonce) } // Make sure the sender is an EOA - codeHash := st.state.GetCodeHash(msg.From) - if codeHash != (common.Hash{}) && codeHash != types.EmptyCodeHash { + if codeHash := st.state.GetCodeHash(msg.From); codeHash != types.EmptyCodeHash { return fmt.Errorf("%w: address %v, codehash: %s", ErrSenderNoEOA, msg.From.Hex(), codeHash) } diff --git a/core/vm/evm.go b/core/vm/evm.go index 2c6cc7d484..6e832c262f 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -436,7 +436,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64, } // Ensure there's no existing contract already at the designated address contractHash := evm.StateDB.GetCodeHash(address) - if evm.StateDB.GetNonce(address) != 0 || (contractHash != (common.Hash{}) && contractHash != types.EmptyCodeHash) { + if evm.StateDB.GetNonce(address) != 0 || contractHash != types.EmptyCodeHash { return nil, common.Address{}, 0, ErrContractAddressCollision } // Create a new account on the state