MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / FetchBlock

Method FetchBlock

sqlchain/chain.go:882–887  ·  view source on GitHub ↗

FetchBlock fetches the block at specified height from local cache.

(height int32)

Source from the content-addressed store, hash-verified

880
881// FetchBlock fetches the block at specified height from local cache.
882func (c *Chain) FetchBlock(height int32) (b *types.Block, err error) {
883 if n := c.rt.getHead().node.ancestor(height); n != nil {
884 return c.fetchBlockByIndexKey(n.indexKey())
885 }
886 return
887}
888
889// FetchBlockByCount fetches the block at specified count from local cache.
890func (c *Chain) FetchBlockByCount(count int32) (b *types.Block, realCount int32, height int32, err error) {

Callers 3

billingMethod · 0.95
updateMetricsMethod · 0.95
TestMultiChainFunction · 0.45

Calls 4

fetchBlockByIndexKeyMethod · 0.95
indexKeyMethod · 0.80
ancestorMethod · 0.45
getHeadMethod · 0.45

Tested by 1

TestMultiChainFunction · 0.36