diff --git a/core/state/database.go b/core/state/database.go index c1b630991ce0..fdfc6ec38b6f 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -83,6 +83,15 @@ func NewDatabase(db ethdb.Database) Database { } } +// NewDatabaseWithTrieDB creates a backing store for state from a previously created trie database. +func NewDatabaseWithTrieDB(db *trie.Database) Database { + csc, _ := lru.New(codeSizeCacheSize) + return &cachingDB{ + db: db, + codeSizeCache: csc, + } +} + type cachingDB struct { db *trie.Database mu sync.Mutex