aboutsummaryrefslogtreecommitdiffstats
path: root/trie/trie_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-11-15 20:42:19 +0800
committerGitHub <noreply@github.com>2018-11-15 20:42:19 +0800
commit17d67c5834679f2b27ef08eddfce3b3a154a96a8 (patch)
tree3989575655db27f02641bf1fc7d96f87a9441ebb /trie/trie_test.go
parent14346e4ef97ca812fb9f1d5d2cd87021c0155cf6 (diff)
parent434dd5bc0067cdf604d84426df9086015721dd36 (diff)
downloaddexon-17d67c5834679f2b27ef08eddfce3b3a154a96a8.tar
dexon-17d67c5834679f2b27ef08eddfce3b3a154a96a8.tar.gz
dexon-17d67c5834679f2b27ef08eddfce3b3a154a96a8.tar.bz2
dexon-17d67c5834679f2b27ef08eddfce3b3a154a96a8.tar.lz
dexon-17d67c5834679f2b27ef08eddfce3b3a154a96a8.tar.xz
dexon-17d67c5834679f2b27ef08eddfce3b3a154a96a8.tar.zst
dexon-17d67c5834679f2b27ef08eddfce3b3a154a96a8.zip
Merge pull request #18087 from karalabe/trie-read-cacher
cmd, core, eth, light, trie: add trie read caching layer
Diffstat (limited to 'trie/trie_test.go')
-rw-r--r--trie/trie_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/trie/trie_test.go b/trie/trie_test.go
index f8e5fd12a..f9d6029c9 100644
--- a/trie/trie_test.go
+++ b/trie/trie_test.go
@@ -119,7 +119,7 @@ func testMissingNode(t *testing.T, memonly bool) {
hash := common.HexToHash("0xe1d943cc8f061a0c0b98162830b970395ac9315654824bf21b73b891365262f9")
if memonly {
- delete(triedb.nodes, hash)
+ delete(triedb.dirties, hash)
} else {
diskdb.Delete(hash[:])
}
@@ -342,15 +342,16 @@ func TestCacheUnload(t *testing.T) {
// Commit the trie repeatedly and access key1.
// The branch containing it is loaded from DB exactly two times:
// in the 0th and 6th iteration.
- db := &countingDB{Database: trie.db.diskdb, gets: make(map[string]int)}
- trie, _ = New(root, NewDatabase(db))
+ diskdb := &countingDB{Database: trie.db.diskdb, gets: make(map[string]int)}
+ triedb := NewDatabase(diskdb)
+ trie, _ = New(root, triedb)
trie.SetCacheLimit(5)
for i := 0; i < 12; i++ {
getString(trie, key1)
trie.Commit(nil)
}
// Check that it got loaded two times.
- for dbkey, count := range db.gets {
+ for dbkey, count := range diskdb.gets {
if count != 2 {
t.Errorf("db key %x loaded %d times, want %d times", []byte(dbkey), count, 2)
}