Skip to content

Commit

Permalink
core/rawdb: simplify TestDiskSeek to use memorydb (ethereum#25182)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbuchwald authored and qinglin89 committed Oct 21, 2022
1 parent 0ca5dd7 commit 8c90dc9
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions core/state/snapshot/disklayer_test.go
Expand Up @@ -18,15 +18,11 @@ package snapshot

import (
"bytes"
"io/ioutil"
"os"
"testing"

"github.com/VictoriaMetrics/fastcache"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb/leveldb"
"github.com/ethereum/go-ethereum/ethdb/memorydb"
"github.com/ethereum/go-ethereum/rlp"
)
Expand Down Expand Up @@ -518,18 +514,7 @@ func TestDiskMidAccountPartialMerge(t *testing.T) {
// TestDiskSeek tests that seek-operations work on the disk layer
func TestDiskSeek(t *testing.T) {
// Create some accounts in the disk layer
var db ethdb.Database

if dir, err := ioutil.TempDir("", "disklayer-test"); err != nil {
t.Fatal(err)
} else {
defer os.RemoveAll(dir)
diskdb, err := leveldb.New(dir, 256, 0, "", false)
if err != nil {
t.Fatal(err)
}
db = rawdb.NewDatabase(diskdb)
}
db := rawdb.NewMemoryDatabase()
// Fill even keys [0,2,4...]
for i := 0; i < 0xff; i += 2 {
acc := common.Hash{byte(i)}
Expand Down

0 comments on commit 8c90dc9

Please sign in to comment.