MCPcopy Create free account
hub / github.com/CPChain/chain / NewDatabase

Function NewDatabase

core/state/database.go:78–84  ·  view source on GitHub ↗

NewDatabase creates a backing store for state. The returned database is safe for concurrent use and retains cached trie nodes in memory. The pool is an optional intermediate trie-node memory pool between the low level storage layer and the high level trie abstraction.

(db database.Database)

Source from the content-addressed store, hash-verified

76// intermediate trie-node memory pool between the low level storage layer and the
77// high level trie abstraction.
78func NewDatabase(db database.Database) Database {
79 csc, _ := lru.New(codeSizeCacheSize)
80 return &cachingDB{
81 db: trie.NewDatabase(db),
82 codeSizeCache: csc,
83 }
84}
85
86type cachingDB struct {
87 db *trie.Database

Callers 11

SetUpTestMethod · 0.85
TestSnapshot2Function · 0.85
TestUpdateLeaksFunction · 0.85
TestIntermediateLeaksFunction · 0.85
TestCopyFunction · 0.85
runMethod · 0.85
TestCopyOfCopyFunction · 0.85
createFunction · 0.85
makeTestStateFunction · 0.85
checkStateAccountsFunction · 0.85
checkStateConsistencyFunction · 0.85

Calls

no outgoing calls

Tested by 11

SetUpTestMethod · 0.68
TestSnapshot2Function · 0.68
TestUpdateLeaksFunction · 0.68
TestIntermediateLeaksFunction · 0.68
TestCopyFunction · 0.68
runMethod · 0.68
TestCopyOfCopyFunction · 0.68
createFunction · 0.68
makeTestStateFunction · 0.68
checkStateAccountsFunction · 0.68
checkStateConsistencyFunction · 0.68