forked from TrueCloudLab/neoneo-go
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:
parent
e2c8fd1d5d
commit
29f1e646ed
1 changed files with 3 additions and 2 deletions
|
@ -2,6 +2,7 @@ package stackitem
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/encoding/bigint"
|
"github.com/nspcc-dev/neo-go/pkg/encoding/bigint"
|
||||||
|
@ -96,7 +97,7 @@ func DecodeBinaryStackItem(r *io.BinReader) Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch t {
|
switch t {
|
||||||
case ByteArrayT:
|
case ByteArrayT, BufferT:
|
||||||
data := r.ReadVarBytes()
|
data := r.ReadVarBytes()
|
||||||
return NewByteArray(data)
|
return NewByteArray(data)
|
||||||
case BooleanT:
|
case BooleanT:
|
||||||
|
@ -132,7 +133,7 @@ func DecodeBinaryStackItem(r *io.BinReader) Item {
|
||||||
case AnyT:
|
case AnyT:
|
||||||
return Null{}
|
return Null{}
|
||||||
default:
|
default:
|
||||||
r.Err = errors.New("unknown type")
|
r.Err = fmt.Errorf("unknown type: %v", t)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue