aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm
diff options
context:
space:
mode:
Diffstat (limited to 'core/vm')
-rw-r--r--core/vm/runtime/runtime.go6
-rw-r--r--core/vm/runtime/runtime_test.go3
2 files changed, 3 insertions, 6 deletions
diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go
index 5ac546406..c8c5d34d9 100644
--- a/core/vm/runtime/runtime.go
+++ b/core/vm/runtime/runtime.go
@@ -99,8 +99,7 @@ func Execute(code, input []byte, cfg *Config) ([]byte, *state.StateDB, error) {
setDefaults(cfg)
if cfg.State == nil {
- db, _ := ethdb.NewMemDatabase()
- cfg.State, _ = state.New(common.Hash{}, state.NewDatabase(db))
+ cfg.State, _ = state.New(common.Hash{}, state.NewDatabase(ethdb.NewMemDatabase()))
}
var (
address = common.BytesToAddress([]byte("contract"))
@@ -130,8 +129,7 @@ func Create(input []byte, cfg *Config) ([]byte, common.Address, uint64, error) {
setDefaults(cfg)
if cfg.State == nil {
- db, _ := ethdb.NewMemDatabase()
- cfg.State, _ = state.New(common.Hash{}, state.NewDatabase(db))
+ cfg.State, _ = state.New(common.Hash{}, state.NewDatabase(ethdb.NewMemDatabase()))
}
var (
vmenv = NewEnv(cfg)
diff --git a/core/vm/runtime/runtime_test.go b/core/vm/runtime/runtime_test.go
index 2c4dc5026..ef664bda3 100644
--- a/core/vm/runtime/runtime_test.go
+++ b/core/vm/runtime/runtime_test.go
@@ -94,8 +94,7 @@ func TestExecute(t *testing.T) {
}
func TestCall(t *testing.T) {
- db, _ := ethdb.NewMemDatabase()
- state, _ := state.New(common.Hash{}, state.NewDatabase(db))
+ state, _ := state.New(common.Hash{}, state.NewDatabase(ethdb.NewMemDatabase()))
address := common.HexToAddress("0x0a")
state.SetCode(address, []byte{
byte(vm.PUSH1), 10,