Commit 037772fc authored by Gustav Simonsson's avatar Gustav Simonsson

fix hex conversion bug in RPC for byte slices

parent 8001e481
...@@ -18,6 +18,7 @@ package rpc ...@@ -18,6 +18,7 @@ package rpc
import ( import (
"encoding/binary" "encoding/binary"
"encoding/hex"
"encoding/json" "encoding/json"
"fmt" "fmt"
"math/big" "math/big"
...@@ -117,7 +118,13 @@ func newHexData(input interface{}) *hexdata { ...@@ -117,7 +118,13 @@ func newHexData(input interface{}) *hexdata {
binary.BigEndian.PutUint32(buff, input) binary.BigEndian.PutUint32(buff, input)
d.data = buff d.data = buff
case string: // hexstring 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: default:
d.isNil = true d.isNil = true
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment