@@ -150,7 +150,6 @@ type Trie interface {
150150type CachingDB struct {
151151 disk ethdb.KeyValueStore
152152 triedb * triedb.Database
153- noTries bool
154153 snap * snapshot.Tree
155154 codeCache * lru.SizeConstrainedCache [common.Hash , []byte ]
156155 codeSizeCache * lru.Cache [common.Hash , int ]
@@ -159,12 +158,9 @@ type CachingDB struct {
159158
160159// NewDatabase creates a state database with the provided data sources.
161160func NewDatabase (triedb * triedb.Database , snap * snapshot.Tree ) * CachingDB {
162- noTries := triedb != nil && triedb .Config () != nil && triedb .Config ().NoTries
163-
164161 return & CachingDB {
165162 disk : triedb .Disk (),
166163 triedb : triedb ,
167- noTries : noTries ,
168164 snap : snap ,
169165 codeCache : lru.NewSizeConstrainedCache [common.Hash , []byte ](codeCacheSize ),
170166 codeSizeCache : lru.NewCache [common.Hash , int ](codeSizeCacheSize ),
@@ -232,7 +228,7 @@ func (db *CachingDB) ReadersWithCacheStats(stateRoot common.Hash) (ReaderWithSta
232228
233229// OpenTrie opens the main account trie at a specific root hash.
234230func (db * CachingDB ) OpenTrie (root common.Hash ) (Trie , error ) {
235- if db .noTries {
231+ if db .NoTries () {
236232 return trie .NewEmptyTrie (), nil
237233 }
238234 if db .triedb .IsVerkle () {
@@ -247,7 +243,7 @@ func (db *CachingDB) OpenTrie(root common.Hash) (Trie, error) {
247243
248244// OpenStorageTrie opens the storage trie of an account.
249245func (db * CachingDB ) OpenStorageTrie (stateRoot common.Hash , address common.Address , root common.Hash , self Trie ) (Trie , error ) {
250- if db .noTries {
246+ if db .NoTries () {
251247 return trie .NewEmptyTrie (), nil
252248 }
253249
@@ -265,7 +261,7 @@ func (db *CachingDB) OpenStorageTrie(stateRoot common.Hash, address common.Addre
265261}
266262
267263func (db * CachingDB ) NoTries () bool {
268- return db .noTries
264+ return db .triedb != nil && db . triedb . Config () != nil && db . triedb . Config (). NoTries
269265}
270266
271267// ContractCodeWithPrefix retrieves a particular contract's code. If the
0 commit comments