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

Method GetBlock

core/store/ledgerstore/block_cache.go:72–78  ·  view source on GitHub ↗

GetBlock return block by block hash from cache

(blockHash common.Uint256)

Source from the content-addressed store, hash-verified

70
71//GetBlock return block by block hash from cache
72func (this *BlockCache) GetBlock(blockHash common.Uint256) *types.Block {
73 block, ok := this.blockCache.Get(string(blockHash.ToArray()))
74 if !ok {
75 return nil
76 }
77 return block.(*types.Block)
78}
79
80//ContainBlock return whether block is in cache
81func (this *BlockCache) ContainBlock(blockHash common.Uint256) bool {

Callers 3

TestBlockFunction · 0.45
recoverStoreMethod · 0.45
GetBlockByHashMethod · 0.45

Calls 2

GetMethod · 0.65
ToArrayMethod · 0.65

Tested by 1

TestBlockFunction · 0.36