diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-18 20:19:41 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-18 20:19:41 +0800 |
commit | 721e8ae93f9b8918ff4bc74af86c530bacacea00 (patch) | |
tree | ee33bd346e396f56d6462f99de9ca7b5dac9c586 /ethutil/rlp.go | |
parent | e6fdf0c9f7564b8b08cf428e03af66fc423adcc1 (diff) | |
parent | 2d09e67713757e2a80eb614562c97f962af36cf7 (diff) | |
download | go-tangerine-721e8ae93f9b8918ff4bc74af86c530bacacea00.tar go-tangerine-721e8ae93f9b8918ff4bc74af86c530bacacea00.tar.gz go-tangerine-721e8ae93f9b8918ff4bc74af86c530bacacea00.tar.bz2 go-tangerine-721e8ae93f9b8918ff4bc74af86c530bacacea00.tar.lz go-tangerine-721e8ae93f9b8918ff4bc74af86c530bacacea00.tar.xz go-tangerine-721e8ae93f9b8918ff4bc74af86c530bacacea00.tar.zst go-tangerine-721e8ae93f9b8918ff4bc74af86c530bacacea00.zip |
Merged develop
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) } |