core/vm/runtime: remove unused state parameter to NewEnv (#14953)

* core: Remove unused `state` parameter to `NewEnv`.

`cfg.State` is used instead.

* core/vm/runtime: remove unused import
pull/14968/head
Joel Burget 7 years ago committed by Péter Szilágyi
parent 2b422b1a47
commit 833eeb9f23
  1. 3
      core/vm/runtime/env.go
  2. 6
      core/vm/runtime/runtime.go

@ -21,11 +21,10 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/vm"
)
func NewEnv(cfg *Config, state *state.StateDB) *vm.EVM {
func NewEnv(cfg *Config) *vm.EVM {
context := vm.Context{
CanTransfer: core.CanTransfer,
Transfer: core.Transfer,

@ -106,7 +106,7 @@ func Execute(code, input []byte, cfg *Config) ([]byte, *state.StateDB, error) {
}
var (
address = common.StringToAddress("contract")
vmenv = NewEnv(cfg, cfg.State)
vmenv = NewEnv(cfg)
sender = vm.AccountRef(cfg.Origin)
)
cfg.State.CreateAccount(address)
@ -136,7 +136,7 @@ func Create(input []byte, cfg *Config) ([]byte, common.Address, uint64, error) {
cfg.State, _ = state.New(common.Hash{}, state.NewDatabase(db))
}
var (
vmenv = NewEnv(cfg, cfg.State)
vmenv = NewEnv(cfg)
sender = vm.AccountRef(cfg.Origin)
)
@ -158,7 +158,7 @@ func Create(input []byte, cfg *Config) ([]byte, common.Address, uint64, error) {
func Call(address common.Address, input []byte, cfg *Config) ([]byte, uint64, error) {
setDefaults(cfg)
vmenv := NewEnv(cfg, cfg.State)
vmenv := NewEnv(cfg)
sender := cfg.State.GetOrNewStateObject(cfg.Origin)
// Call the code with the given configuration.

Loading…
Cancel
Save