|
|
|
@ -1915,6 +1915,19 @@ func NewPublicDebugAPI(b Backend) *PublicDebugAPI { |
|
|
|
|
return &PublicDebugAPI{b: b} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// GetHeaderRlp retrieves the RLP encoded for of a single header.
|
|
|
|
|
func (api *PublicDebugAPI) GetHeaderRlp(ctx context.Context, number uint64) (string, error) { |
|
|
|
|
header, _ := api.b.HeaderByNumber(ctx, rpc.BlockNumber(number)) |
|
|
|
|
if header == nil { |
|
|
|
|
return "", fmt.Errorf("header #%d not found", number) |
|
|
|
|
} |
|
|
|
|
encoded, err := rlp.EncodeToBytes(header) |
|
|
|
|
if err != nil { |
|
|
|
|
return "", err |
|
|
|
|
} |
|
|
|
|
return fmt.Sprintf("%x", encoded), nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// GetBlockRlp retrieves the RLP encoded for of a single block.
|
|
|
|
|
func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (string, error) { |
|
|
|
|
block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number)) |
|
|
|
|