From 037772fc0713264b53441d4956a52842f0288859 Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Tue, 12 May 2015 17:04:56 +0200 Subject: fix hex conversion bug in RPC for byte slices --- rpc/types.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'rpc') diff --git a/rpc/types.go b/rpc/types.go index e6eb4f856..1f49a3dea 100644 --- a/rpc/types.go +++ b/rpc/types.go @@ -18,6 +18,7 @@ package rpc import ( "encoding/binary" + "encoding/hex" "encoding/json" "fmt" "math/big" @@ -117,7 +118,13 @@ func newHexData(input interface{}) *hexdata { binary.BigEndian.PutUint32(buff, input) d.data = buff case string: // hexstring - d.data = common.Big(input).Bytes() + // aaargh ffs TODO: avoid back-and-forth hex encodings where unneeded + bytes, err := hex.DecodeString(strings.TrimPrefix(input, "0x")) + if err != nil { + d.isNil = true + } else { + d.data = bytes + } default: d.isNil = true } -- cgit