internal/ethapi: block not found print hex string

This commit is contained in:
Weixie Cui 2026-05-19 20:00:00 +08:00
parent d4027f3d46
commit 2639b76d82

View file

@ -2013,7 +2013,7 @@ func (api *DebugAPI) GetRawHeader(ctx context.Context, blockNrOrHash rpc.BlockNu
} }
header, _ := api.b.HeaderByHash(ctx, hash) header, _ := api.b.HeaderByHash(ctx, hash)
if header == nil { if header == nil {
return nil, fmt.Errorf("header #%d not found", hash) return nil, fmt.Errorf("header %s not found", hash.Hex())
} }
return rlp.EncodeToBytes(header) return rlp.EncodeToBytes(header)
} }
@ -2032,7 +2032,7 @@ func (api *DebugAPI) GetRawBlock(ctx context.Context, blockNrOrHash rpc.BlockNum
} }
block, _ := api.b.BlockByHash(ctx, hash) block, _ := api.b.BlockByHash(ctx, hash)
if block == nil { if block == nil {
return nil, fmt.Errorf("block #%d not found", hash) return nil, fmt.Errorf("block %s not found", hash.Hex())
} }
return rlp.EncodeToBytes(block) return rlp.EncodeToBytes(block)
} }