core/rawdb: simplify TestDiskSeek to use memorydb (#25182)
This commit is contained in:
parent
0ca5dd727a
commit
8c90dc946a
@ -18,15 +18,11 @@ package snapshot
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/VictoriaMetrics/fastcache"
|
"github.com/VictoriaMetrics/fastcache"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
"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/ethdb/memorydb"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
)
|
)
|
||||||
@ -518,18 +514,7 @@ func TestDiskMidAccountPartialMerge(t *testing.T) {
|
|||||||
// TestDiskSeek tests that seek-operations work on the disk layer
|
// TestDiskSeek tests that seek-operations work on the disk layer
|
||||||
func TestDiskSeek(t *testing.T) {
|
func TestDiskSeek(t *testing.T) {
|
||||||
// Create some accounts in the disk layer
|
// Create some accounts in the disk layer
|
||||||
var db ethdb.Database
|
db := rawdb.NewMemoryDatabase()
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
// Fill even keys [0,2,4...]
|
// Fill even keys [0,2,4...]
|
||||||
for i := 0; i < 0xff; i += 2 {
|
for i := 0; i < 0xff; i += 2 {
|
||||||
acc := common.Hash{byte(i)}
|
acc := common.Hash{byte(i)}
|
||||||
|
Loading…
Reference in New Issue
Block a user