vm: implement BigInteger item serialization

This commit is contained in:
Evgenii Stratonikov 2019-11-05 12:07:08 +03:00
parent 25f77257ce
commit cd690803cf
4 changed files with 28 additions and 4 deletions

View file

@ -6,6 +6,8 @@ import (
"fmt"
"math/big"
"reflect"
"github.com/CityOfZion/neo-go/pkg/util"
)
// A StackItem represents the "real" value that is pushed on the stack.
@ -131,6 +133,11 @@ func NewBigIntegerItem(value int) *BigIntegerItem {
}
}
// Bytes converts i to a slice of bytes.
func (i *BigIntegerItem) Bytes() []byte {
return util.ArrayReverse(i.value.Bytes())
}
// Value implements StackItem interface.
func (i *BigIntegerItem) Value() interface{} {
return i.value