aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-05-12 23:04:56 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-05-12 23:22:17 +0800
commit037772fc0713264b53441d4956a52842f0288859 (patch)
tree14cd275b93fa7f1604ee4244154ac88a7fa48087
parent8001e48115fdfa9a032d4c3c3d4d772cd08592c5 (diff)
downloadgo-tangerine-037772fc0713264b53441d4956a52842f0288859.tar
go-tangerine-037772fc0713264b53441d4956a52842f0288859.tar.gz
go-tangerine-037772fc0713264b53441d4956a52842f0288859.tar.bz2
go-tangerine-037772fc0713264b53441d4956a52842f0288859.tar.lz
go-tangerine-037772fc0713264b53441d4956a52842f0288859.tar.xz
go-tangerine-037772fc0713264b53441d4956a52842f0288859.tar.zst
go-tangerine-037772fc0713264b53441d4956a52842f0288859.zip
fix hex conversion bug in RPC for byte slices
-rw-r--r--rpc/types.go9
1 files changed, 8 insertions, 1 deletions
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
}