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

Method GetBlockByNumber

core/blockchain.go:737–743  ·  view source on GitHub ↗

GetBlockByNumber retrieves a block from the database by number, caching it (associated with its hash) if found.

(number uint64)

Source from the content-addressed store, hash-verified

735// GetBlockByNumber retrieves a block from the database by number, caching it
736// (associated with its hash) if found.
737func (bc *BlockChain) GetBlockByNumber(number uint64) *types.Block {
738 hash := rawdb.ReadCanonicalHash(bc.db, number)
739 if hash == (common.Hash{}) {
740 return nil
741 }
742 return bc.GetBlock(hash, number)
743}
744
745// GetReceiptsByHash retrieves the receipts for all transactions in a given block.
746func (bc *BlockChain) GetReceiptsByHash(hash common.Hash) types.Receipts {

Callers 4

NewBlockChainFunction · 0.95
ExportNMethod · 0.95
CommitStateDBMethod · 0.95
insertChainMethod · 0.95

Calls 1

GetBlockMethod · 0.95

Tested by

no test coverage detected