diff --git a/core/vm/evm.go b/core/vm/evm.go index bdf3e2aeb2..cae2b47b98 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -137,7 +137,7 @@ func NewEVM(blockCtx BlockContext, statedb StateDB, chainConfig *params.ChainCon Config: config, chainConfig: chainConfig, chainRules: chainConfig.Rules(blockCtx.BlockNumber, blockCtx.Random != nil, blockCtx.Time), - jumpDests: nil, + jumpDests: newMapJumpDests(), } evm.precompiles = activePrecompiledContracts(evm.chainRules) evm.interpreter = NewEVMInterpreter(evm) @@ -244,9 +244,6 @@ func (evm *EVM) Call(caller common.Address, addr common.Address, input []byte, g ret, err = nil, nil // gas is unchanged } else { // The contract is a scoped environment for this execution context only. - if evm.jumpDests == nil { - evm.jumpDests = newMapJumpDests() - } contract := NewContract(caller, addr, value, gas, evm.jumpDests) contract.IsSystemCall = isSystemCall(caller) contract.SetCallCode(evm.resolveCodeHash(addr), code) @@ -307,9 +304,6 @@ func (evm *EVM) CallCode(caller common.Address, addr common.Address, input []byt } else { // Initialise a new contract and set the code that is to be used by the EVM. // The contract is a scoped environment for this execution context only. - if evm.jumpDests == nil { - evm.jumpDests = newMapJumpDests() - } contract := NewContract(caller, caller, value, gas, evm.jumpDests) contract.SetCallCode(evm.resolveCodeHash(addr), evm.resolveCode(addr)) ret, err = evm.interpreter.Run(contract, input, false) @@ -354,9 +348,6 @@ func (evm *EVM) DelegateCall(originCaller common.Address, caller common.Address, // Initialise a new contract and make initialise the delegate values // // Note: The value refers to the original value from the parent call. - if evm.jumpDests == nil { - evm.jumpDests = newMapJumpDests() - } contract := NewContract(originCaller, caller, value, gas, evm.jumpDests) contract.SetCallCode(evm.resolveCodeHash(addr), evm.resolveCode(addr)) ret, err = evm.interpreter.Run(contract, input, false) @@ -408,9 +399,6 @@ func (evm *EVM) StaticCall(caller common.Address, addr common.Address, input []b } else { // Initialise a new contract and set the code that is to be used by the EVM. // The contract is a scoped environment for this execution context only. - if evm.jumpDests == nil { - evm.jumpDests = newMapJumpDests() - } contract := NewContract(caller, addr, new(uint256.Int), gas, evm.jumpDests) contract.SetCallCode(evm.resolveCodeHash(addr), evm.resolveCode(addr)) @@ -518,9 +506,6 @@ func (evm *EVM) create(caller common.Address, code []byte, gas uint64, value *ui // Initialise a new contract and set the code that is to be used by the EVM. // The contract is a scoped environment for this execution context only. - if evm.jumpDests == nil { - evm.jumpDests = newMapJumpDests() - } contract := NewContract(caller, address, value, gas, evm.jumpDests) // Explicitly set the code to a null hash to prevent caching of jump analysis