Commit df3366d9 authored by obscuren's avatar obscuren

Rlp shouldn't write null bytes

parent 4dbdcaec
...@@ -2,7 +2,6 @@ package ethutil ...@@ -2,7 +2,6 @@ package ethutil
import ( import (
"bytes" "bytes"
"encoding/binary"
"fmt" "fmt"
"math/big" "math/big"
"reflect" "reflect"
...@@ -193,8 +192,13 @@ func Encode(object interface{}) []byte { ...@@ -193,8 +192,13 @@ func Encode(object interface{}) []byte {
if blen < 56 { if blen < 56 {
buff.WriteByte(byte(blen) + 0xc0) buff.WriteByte(byte(blen) + 0xc0)
} else { } else {
buff.WriteByte(byte(intlen(int64(blen))) + 0xf7) ilen := byte(intlen(int64(blen)))
binary.Write(&buff, binary.BigEndian, 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) buff.ReadFrom(&b)
} }
......
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