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

Method BlockByNumber

api/cpclient/cpclient.go:81–83  ·  view source on GitHub ↗

BlockByNumber returns a block from the current canonical chain. If number is nil, the latest known block is returned. Note that loading full blocks requires two requests. Use HeaderByNumber if you don't need all transactions or uncle headers.

(ctx context.Context, number *big.Int)

Source from the content-addressed store, hash-verified

79// Note that loading full blocks requires two requests. Use HeaderByNumber
80// if you don't need all transactions or uncle headers.
81func (c *Client) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) {
82 return c.getBlock(ctx, "eth_getBlockByNumber", toBlockNumArg(number), true)
83}
84
85type rpcBlock struct {
86 Hash common.Hash `json:"hash"`

Callers

nothing calls this directly

Calls 2

getBlockMethod · 0.95
toBlockNumArgFunction · 0.85

Tested by

no test coverage detected