core, trie: cleanup trie database (#28062)

This commit is contained in:
rjl493456442
2023-09-07 21:17:14 +08:00
committed by GitHub
parent a8d7201ec5
commit a7842c9cae
4 changed files with 20 additions and 26 deletions
+9 -4
View File
@@ -25,11 +25,16 @@ import (
// newTestDatabase initializes the trie database with specified scheme.
func newTestDatabase(diskdb ethdb.Database, scheme string) *Database {
db := prepare(diskdb, nil)
config := &Config{Preimages: false}
if scheme == rawdb.HashScheme {
db.backend = hashdb.New(diskdb, &hashdb.Config{}, mptResolver{})
config.HashDB = &hashdb.Config{
CleanCacheSize: 0,
} // disable clean cache
} else {
db.backend = pathdb.New(diskdb, &pathdb.Config{}) // disable clean/dirty cache
config.PathDB = &pathdb.Config{
CleanCacheSize: 0,
DirtyCacheSize: 0,
} // disable clean/dirty cache
}
return db
return NewDatabase(diskdb, config)
}