MCPcopy Create free account
hub / github.com/DNAProject/DNA / NewBlockCache

Function NewBlockCache

core/store/ledgerstore/block_cache.go:50–63  ·  view source on GitHub ↗

NewBlockCache return BlockCache instance

()

Source from the content-addressed store, hash-verified

48
49//NewBlockCache return BlockCache instance
50func NewBlockCache() (*BlockCache, error) {
51 blockCache, err := lru.NewARC(BLOCK_CAHE_SIZE)
52 if err != nil {
53 return nil, fmt.Errorf("NewARC block error %s", err)
54 }
55 transactionCache, err := lru.NewARC(TRANSACTION_CACHE_SIZE)
56 if err != nil {
57 return nil, fmt.Errorf("NewARC header error %s", err)
58 }
59 return &BlockCache{
60 blockCache: blockCache,
61 transactionCache: transactionCache,
62 }, nil
63}
64
65//AddBlock to cache
66func (this *BlockCache) AddBlock(block *types.Block) {

Callers 1

NewBlockStoreFunction · 0.70

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected