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

Method HasHeader

core/headerchain.go:369–374  ·  view source on GitHub ↗

HasHeader checks if a block header is present in the database or not.

(hash common.Hash, number uint64)

Source from the content-addressed store, hash-verified

367
368// HasHeader checks if a block header is present in the database or not.
369func (hc *HeaderChain) HasHeader(hash common.Hash, number uint64) bool {
370 if hc.numberCache.Contains(hash) || hc.headerCache.Contains(hash) {
371 return true
372 }
373 return rawdb.HasHeader(hc.chainDb, hash, number)
374}
375
376// GetHeaderByNumber retrieves a block header from the database by number,
377// caching it (associated with its hash) if found.

Callers 1

InsertHeaderChainMethod · 0.95

Calls 1

ContainsMethod · 0.65

Tested by

no test coverage detected