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

Method HeaderByHash

api/cpclient/cpclient.go:127–134  ·  view source on GitHub ↗

HeaderByHash returns the block header with the given hash.

(ctx context.Context, hash common.Hash)

Source from the content-addressed store, hash-verified

125
126// HeaderByHash returns the block header with the given hash.
127func (c *Client) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) {
128 var head *types.Header
129 err := c.c.CallContext(ctx, &head, "eth_getBlockByHash", hash, false)
130 if err == nil && head == nil {
131 err = cpchain.NotFound
132 }
133 return head, err
134}
135
136// HeaderByNumber returns a block header from the current canonical chain. If number is
137// nil, the latest known header is returned.

Callers

nothing calls this directly

Calls 1

CallContextMethod · 0.80

Tested by

no test coverage detected