diff options
author | Péter Szilágyi <peterke@gmail.com> | 2019-03-07 16:21:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-07 16:21:40 +0800 |
commit | 72b21db2d31d77d956c09353457a0c2db45249b0 (patch) | |
tree | c0c750bfbbc5b5d8e9622847b676c1f4d99f4020 /core/vm | |
parent | f2d63103541ee3746ff0834e7c69d188af3572d2 (diff) | |
parent | 054412e33528e53f6deae940c870217b614707b9 (diff) | |
download | go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar.gz go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar.bz2 go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar.lz go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar.xz go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar.zst go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.zip |
Merge pull request #19021 from karalabe/database-cleanup
all: clean up and properly abstract database accesses
Diffstat (limited to 'core/vm')
-rw-r--r-- | core/vm/runtime/runtime.go | 6 | ||||
-rw-r--r-- | core/vm/runtime/runtime_test.go | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go index cda49a34b..db1f6f382 100644 --- a/core/vm/runtime/runtime.go +++ b/core/vm/runtime/runtime.go @@ -22,10 +22,10 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/params" ) @@ -99,7 +99,7 @@ func Execute(code, input []byte, cfg *Config) ([]byte, *state.StateDB, error) { setDefaults(cfg) if cfg.State == nil { - cfg.State, _ = state.New(common.Hash{}, state.NewDatabase(ethdb.NewMemDatabase())) + cfg.State, _ = state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase())) } var ( address = common.BytesToAddress([]byte("contract")) @@ -129,7 +129,7 @@ func Create(input []byte, cfg *Config) ([]byte, common.Address, uint64, error) { setDefaults(cfg) if cfg.State == nil { - cfg.State, _ = state.New(common.Hash{}, state.NewDatabase(ethdb.NewMemDatabase())) + cfg.State, _ = state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase())) } var ( vmenv = NewEnv(cfg) diff --git a/core/vm/runtime/runtime_test.go b/core/vm/runtime/runtime_test.go index bac06e524..15f545ddc 100644 --- a/core/vm/runtime/runtime_test.go +++ b/core/vm/runtime/runtime_test.go @@ -23,9 +23,9 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/params" ) @@ -95,7 +95,7 @@ func TestExecute(t *testing.T) { } func TestCall(t *testing.T) { - state, _ := state.New(common.Hash{}, state.NewDatabase(ethdb.NewMemDatabase())) + state, _ := state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase())) address := common.HexToAddress("0x0a") state.SetCode(address, []byte{ byte(vm.PUSH1), 10, @@ -151,7 +151,7 @@ func BenchmarkCall(b *testing.B) { } func benchmarkEVM_Create(bench *testing.B, code string) { var ( - statedb, _ = state.New(common.Hash{}, state.NewDatabase(ethdb.NewMemDatabase())) + statedb, _ = state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase())) sender = common.BytesToAddress([]byte("sender")) receiver = common.BytesToAddress([]byte("receiver")) ) |