GetBlockRlp retrieves the RLP encoded for of a single block.
(ctx context.Context, number uint64)
| 1693 | |
| 1694 | // GetBlockRlp retrieves the RLP encoded for of a single block. |
| 1695 | func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (string, error) { |
| 1696 | block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number)) |
| 1697 | if block == nil { |
| 1698 | return "", fmt.Errorf("block #%d not found", number) |
| 1699 | } |
| 1700 | encoded, err := rlp.EncodeToBytes(block) |
| 1701 | if err != nil { |
| 1702 | return "", err |
| 1703 | } |
| 1704 | return fmt.Sprintf("%x", encoded), nil |
| 1705 | } |
| 1706 | |
| 1707 | // PrintBlock retrieves a block and returns its pretty printed form. |
| 1708 | func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error) { |
nothing calls this directly
no test coverage detected