io: refactoring for using WriteVarBytes instead of WriteLE

goal is to be consistent with C# implementation.
For writing []byte WriteBytes used and for byte - WriteVarByte.
This commit is contained in:
Vsevolod Brekelov 2019-11-22 13:34:06 +03:00
parent d02673c112
commit 03ff2976ed
20 changed files with 33 additions and 34 deletions

View file

@ -44,13 +44,13 @@ func serializeItemTo(item StackItem, w *io.BinWriter, seen map[StackItem]bool) {
switch t := item.(type) {
case *ByteArrayItem:
w.WriteLE(byte(byteArrayT))
w.WriteBytes(t.value)
w.WriteVarBytes(t.value)
case *BoolItem:
w.WriteLE(byte(booleanT))
w.WriteLE(t.value)
case *BigIntegerItem:
w.WriteLE(byte(integerT))
w.WriteBytes(t.Bytes())
w.WriteVarBytes(t.Bytes())
case *InteropItem:
w.Err = errors.New("not supported")
case *ArrayItem, *StructItem: