aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/util.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-05 04:13:31 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-05 04:13:31 +0800
commit15765517417001a8dffc1180d7621b4284f4443e (patch)
tree315dd7500fd9ccd7339451b5a58d0a7d8935f373 /rpc/util.go
parent9b0f00baf35b7eaa323f2679a07da198369b249e (diff)
downloaddexon-15765517417001a8dffc1180d7621b4284f4443e.tar.gz
dexon-15765517417001a8dffc1180d7621b4284f4443e.tar.zst
dexon-15765517417001a8dffc1180d7621b4284f4443e.zip
Output 0x0 instead of 0x
Diffstat (limited to 'rpc/util.go')
-rw-r--r--rpc/util.go7
1 files changed, 6 insertions, 1 deletions
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 {