aboutsummaryrefslogtreecommitdiffstats
path: root/trie/trie_test.go
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-05-09 20:24:25 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-05-09 20:24:25 +0800
commit7beccb29becf439df7bf4c033a94c019ad25bead (patch)
tree5d8581c15f3f110c765c6383e0c4c7724418d6f0 /trie/trie_test.go
parent5dbd8b42a90779bd4269012c1336679fd4ca9824 (diff)
downloaddexon-7beccb29becf439df7bf4c033a94c019ad25bead.tar
dexon-7beccb29becf439df7bf4c033a94c019ad25bead.tar.gz
dexon-7beccb29becf439df7bf4c033a94c019ad25bead.tar.bz2
dexon-7beccb29becf439df7bf4c033a94c019ad25bead.tar.lz
dexon-7beccb29becf439df7bf4c033a94c019ad25bead.tar.xz
dexon-7beccb29becf439df7bf4c033a94c019ad25bead.tar.zst
dexon-7beccb29becf439df7bf4c033a94c019ad25bead.zip
all: get rid of error when creating memory database (#16716)
* all: get rid of error when create mdb * core: clean up variables definition * all: inline mdb definition
Diffstat (limited to 'trie/trie_test.go')
-rw-r--r--trie/trie_test.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/trie/trie_test.go b/trie/trie_test.go
index 997222628..f8e5fd12a 100644
--- a/trie/trie_test.go
+++ b/trie/trie_test.go
@@ -43,8 +43,7 @@ func init() {
// Used for testing
func newEmpty() *Trie {
- diskdb, _ := ethdb.NewMemDatabase()
- trie, _ := New(common.Hash{}, NewDatabase(diskdb))
+ trie, _ := New(common.Hash{}, NewDatabase(ethdb.NewMemDatabase()))
return trie
}
@@ -68,8 +67,7 @@ func TestNull(t *testing.T) {
}
func TestMissingRoot(t *testing.T) {
- diskdb, _ := ethdb.NewMemDatabase()
- trie, err := New(common.HexToHash("0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33"), NewDatabase(diskdb))
+ trie, err := New(common.HexToHash("0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33"), NewDatabase(ethdb.NewMemDatabase()))
if trie != nil {
t.Error("New returned non-nil trie for invalid root")
}
@@ -82,7 +80,7 @@ func TestMissingNodeDisk(t *testing.T) { testMissingNode(t, false) }
func TestMissingNodeMemonly(t *testing.T) { testMissingNode(t, true) }
func testMissingNode(t *testing.T, memonly bool) {
- diskdb, _ := ethdb.NewMemDatabase()
+ diskdb := ethdb.NewMemDatabase()
triedb := NewDatabase(diskdb)
trie, _ := New(common.Hash{}, triedb)
@@ -413,8 +411,7 @@ func (randTest) Generate(r *rand.Rand, size int) reflect.Value {
}
func runRandTest(rt randTest) bool {
- diskdb, _ := ethdb.NewMemDatabase()
- triedb := NewDatabase(diskdb)
+ triedb := NewDatabase(ethdb.NewMemDatabase())
tr, _ := New(common.Hash{}, triedb)
values := make(map[string]string) // tracks content of the trie