From 15765517417001a8dffc1180d7621b4284f4443e Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Wed, 4 Mar 2015 14:13:31 -0600 Subject: [PATCH] Output 0x0 instead of 0x --- rpc/util.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rpc/util.go b/rpc/util.go index 3e8ca3fef..69c7b629f 100644 --- a/rpc/util.go +++ b/rpc/util.go @@ -63,7 +63,12 @@ func (self JsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error) } func toHex(b []byte) string { - return "0x" + ethutil.Bytes2Hex(b) + hex := ethutil.Bytes2Hex(b) + // Prefer output of "0x0" instead of "0x" + if len(hex) == 0 { + hex = "0" + } + return "0x" + hex } func fromHex(s string) []byte { if len(s) > 1 {