aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-04-02 18:52:25 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-04-02 18:52:25 +0800
commitedfd2757d9d958dca936fe38efe350cf60b2c3ce (patch)
tree40b014da8077550e873e0994504cac3399e30187
parentb10e33c04011c9b9f52841ed09de0b8d4cb5bc6a (diff)
downloaddexon-edfd2757d9d958dca936fe38efe350cf60b2c3ce.tar
dexon-edfd2757d9d958dca936fe38efe350cf60b2c3ce.tar.gz
dexon-edfd2757d9d958dca936fe38efe350cf60b2c3ce.tar.bz2
dexon-edfd2757d9d958dca936fe38efe350cf60b2c3ce.tar.lz
dexon-edfd2757d9d958dca936fe38efe350cf60b2c3ce.tar.xz
dexon-edfd2757d9d958dca936fe38efe350cf60b2c3ce.tar.zst
dexon-edfd2757d9d958dca936fe38efe350cf60b2c3ce.zip
Better decoding of uint*
-rw-r--r--rpc/types.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/rpc/types.go b/rpc/types.go
index 205b58b0a..0789a9901 100644
--- a/rpc/types.go
+++ b/rpc/types.go
@@ -101,11 +101,15 @@ func newHexData(input interface{}) *hexdata {
case int16:
d.data = big.NewInt(int64(input)).Bytes()
case uint16:
- d.data = big.NewInt(int64(input)).Bytes()
+ buff := make([]byte, 8)
+ binary.BigEndian.PutUint16(buff, input)
+ d.data = buff
case int32:
d.data = big.NewInt(int64(input)).Bytes()
case uint32:
- d.data = big.NewInt(int64(input)).Bytes()
+ buff := make([]byte, 8)
+ binary.BigEndian.PutUint32(buff, input)
+ d.data = buff
case string: // hexstring
d.data = common.Big(input).Bytes()
default: