vm: add TryInteger() to StackItem interface

Conversion should be done in a StackItem, not in an Element.
This commit is contained in:
Evgenii Stratonikov 2020-03-19 18:21:56 +03:00
parent dd38e3ec3b
commit be407332b9
3 changed files with 55 additions and 12 deletions

View file

@ -3,6 +3,7 @@ package vm
import (
"encoding/binary"
"errors"
"math/big"
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
@ -178,6 +179,11 @@ func (c *Context) TryBytes() ([]byte, error) {
return nil, errors.New("can't convert Context to ByteArray")
}
// TryInteger implements StackItem interface.
func (c *Context) TryInteger() (*big.Int, error) {
return nil, errors.New("can't convert Context to Integer")
}
// Equals implements StackItem interface.
func (c *Context) Equals(s StackItem) bool {
return c == s