vm: fix stackitem serialisation

We're able to serialise Buffer stackitem, but can not deserealise it
which leads to errors. Fixed.
This commit is contained in:
Anna Shaleva 2020-07-06 14:35:55 +03:00
parent e2c8fd1d5d
commit 29f1e646ed

View file

@ -2,6 +2,7 @@ package stackitem
import (
"errors"
"fmt"
"math/big"
"github.com/nspcc-dev/neo-go/pkg/encoding/bigint"
@ -96,7 +97,7 @@ func DecodeBinaryStackItem(r *io.BinReader) Item {
}
switch t {
case ByteArrayT:
case ByteArrayT, BufferT:
data := r.ReadVarBytes()
return NewByteArray(data)
case BooleanT:
@ -132,7 +133,7 @@ func DecodeBinaryStackItem(r *io.BinReader) Item {
case AnyT:
return Null{}
default:
r.Err = errors.New("unknown type")
r.Err = fmt.Errorf("unknown type: %v", t)
return nil
}
}