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

Method PrintBlock

internal/cpcapi/api.go:1708–1714  ·  view source on GitHub ↗

PrintBlock retrieves a block and returns its pretty printed form.

(ctx context.Context, number uint64)

Source from the content-addressed store, hash-verified

1706
1707// PrintBlock retrieves a block and returns its pretty printed form.
1708func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error) {
1709 block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number))
1710 if block == nil {
1711 return "", fmt.Errorf("block #%d not found", number)
1712 }
1713 return spew.Sdump(block), nil
1714}
1715
1716// PrivateDebugAPI is the collection of Cpchain APIs exposed over the private
1717// debugging endpoint.

Callers

nothing calls this directly

Calls 2

BlockNumberMethod · 0.80
BlockByNumberMethod · 0.65

Tested by

no test coverage detected