Skip to content
9 changes: 9 additions & 0 deletions core/state/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down