diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-02 17:30:27 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-02 17:30:27 +0800 |
commit | 0fb1bcd32192b8bf05a328b955a08da4cefe0180 (patch) | |
tree | 67460b927eb41b2876e8e6b7eb9dece494dbd088 /ethutil/rlp.go | |
parent | 8da07e91e40c1d1bb43763b7e959ae92e5770af2 (diff) | |
parent | a4dc12f12c7a06f5e28d5b1e760249875ef7a8c5 (diff) | |
download | dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar.gz dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar.bz2 dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar.lz dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar.xz dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.tar.zst dexon-0fb1bcd32192b8bf05a328b955a08da4cefe0180.zip |
Merge branch 'poc8' into docbranch
Diffstat (limited to 'ethutil/rlp.go')
-rw-r--r-- | ethutil/rlp.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ethutil/rlp.go b/ethutil/rlp.go index 157dd4dd9..1bc1a58a7 100644 --- a/ethutil/rlp.go +++ b/ethutil/rlp.go @@ -2,7 +2,6 @@ package ethutil import ( "bytes" - "encoding/binary" "fmt" "math/big" "reflect" @@ -193,8 +192,13 @@ func Encode(object interface{}) []byte { if blen < 56 { buff.WriteByte(byte(blen) + 0xc0) } else { - buff.WriteByte(byte(intlen(int64(blen))) + 0xf7) - binary.Write(&buff, binary.BigEndian, int64(blen)) + ilen := byte(intlen(int64(blen))) + buff.WriteByte(ilen + 0xf7) + t := make([]byte, ilen) + for i := byte(0); i < ilen; i++ { + t[ilen-i-1] = byte(blen >> (i * 8)) + } + buff.Write(t) } buff.ReadFrom(&b) } |