forked from TrueCloudLab/neoneo-go
vm: allow to make stackitem from *Uint160 and *Uint256
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
d493afc941
commit
8e085d3ca3
2 changed files with 27 additions and 0 deletions
|
@ -132,6 +132,16 @@ func Make(v any) Item {
|
|||
return Make(val.BytesBE())
|
||||
case util.Uint256:
|
||||
return Make(val.BytesBE())
|
||||
case *util.Uint160:
|
||||
if val == nil {
|
||||
return Null{}
|
||||
}
|
||||
return Make(*val)
|
||||
case *util.Uint256:
|
||||
if val == nil {
|
||||
return Null{}
|
||||
}
|
||||
return Make(*val)
|
||||
case nil:
|
||||
return Null{}
|
||||
default:
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/bigint"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -81,6 +82,22 @@ var makeStackItemTestCases = []struct {
|
|||
input: nil,
|
||||
result: Null{},
|
||||
},
|
||||
{
|
||||
input: &util.Uint160{1, 2, 3},
|
||||
result: NewByteArray(util.Uint160{1, 2, 3}.BytesBE()),
|
||||
},
|
||||
{
|
||||
input: &util.Uint256{1, 2, 3},
|
||||
result: NewByteArray(util.Uint256{1, 2, 3}.BytesBE()),
|
||||
},
|
||||
{
|
||||
input: (*util.Uint160)(nil),
|
||||
result: Null{},
|
||||
},
|
||||
{
|
||||
input: (*util.Uint256)(nil),
|
||||
result: Null{},
|
||||
},
|
||||
}
|
||||
|
||||
var makeStackItemErrorCases = []struct {
|
||||
|
|
Loading…
Reference in a new issue