aboutsummaryrefslogtreecommitdiffstats
path: root/core/state/sync_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/state/sync_test.go')
-rw-r--r--core/state/sync_test.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/core/state/sync_test.go b/core/state/sync_test.go
index 8f14a44e7..317740160 100644
--- a/core/state/sync_test.go
+++ b/core/state/sync_test.go
@@ -38,8 +38,7 @@ type testAccount struct {
// makeTestState create a sample test state to test node-wise reconstruction.
func makeTestState() (Database, common.Hash, []*testAccount) {
// Create an empty state
- diskdb, _ := ethdb.NewMemDatabase()
- db := NewDatabase(diskdb)
+ db := NewDatabase(ethdb.NewMemDatabase())
state, _ := New(common.Hash{}, db)
// Fill it with some arbitrary data
@@ -125,8 +124,7 @@ func checkStateConsistency(db ethdb.Database, root common.Hash) error {
// Tests that an empty state is not scheduled for syncing.
func TestEmptyStateSync(t *testing.T) {
empty := common.HexToHash("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
- db, _ := ethdb.NewMemDatabase()
- if req := NewStateSync(empty, db).Missing(1); len(req) != 0 {
+ if req := NewStateSync(empty, ethdb.NewMemDatabase()).Missing(1); len(req) != 0 {
t.Errorf("content requested for empty state: %v", req)
}
}
@@ -141,7 +139,7 @@ func testIterativeStateSync(t *testing.T, batch int) {
srcDb, srcRoot, srcAccounts := makeTestState()
// Create a destination state and sync with the scheduler
- dstDb, _ := ethdb.NewMemDatabase()
+ dstDb := ethdb.NewMemDatabase()
sched := NewStateSync(srcRoot, dstDb)
queue := append([]common.Hash{}, sched.Missing(batch)...)
@@ -173,7 +171,7 @@ func TestIterativeDelayedStateSync(t *testing.T) {
srcDb, srcRoot, srcAccounts := makeTestState()
// Create a destination state and sync with the scheduler
- dstDb, _ := ethdb.NewMemDatabase()
+ dstDb := ethdb.NewMemDatabase()
sched := NewStateSync(srcRoot, dstDb)
queue := append([]common.Hash{}, sched.Missing(0)...)
@@ -210,7 +208,7 @@ func testIterativeRandomStateSync(t *testing.T, batch int) {
srcDb, srcRoot, srcAccounts := makeTestState()
// Create a destination state and sync with the scheduler
- dstDb, _ := ethdb.NewMemDatabase()
+ dstDb := ethdb.NewMemDatabase()
sched := NewStateSync(srcRoot, dstDb)
queue := make(map[common.Hash]struct{})
@@ -250,7 +248,7 @@ func TestIterativeRandomDelayedStateSync(t *testing.T) {
srcDb, srcRoot, srcAccounts := makeTestState()
// Create a destination state and sync with the scheduler
- dstDb, _ := ethdb.NewMemDatabase()
+ dstDb := ethdb.NewMemDatabase()
sched := NewStateSync(srcRoot, dstDb)
queue := make(map[common.Hash]struct{})
@@ -297,7 +295,7 @@ func TestIncompleteStateSync(t *testing.T) {
checkTrieConsistency(srcDb.TrieDB().DiskDB().(ethdb.Database), srcRoot)
// Create a destination state and sync with the scheduler
- dstDb, _ := ethdb.NewMemDatabase()
+ dstDb := ethdb.NewMemDatabase()
sched := NewStateSync(srcRoot, dstDb)
added := []common.Hash{}