diff --git a/pkg/vm/stackitem/item.go b/pkg/vm/stackitem/item.go index 8e5952a46..7f86879b5 100644 --- a/pkg/vm/stackitem/item.go +++ b/pkg/vm/stackitem/item.go @@ -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: diff --git a/pkg/vm/stackitem/item_test.go b/pkg/vm/stackitem/item_test.go index c90763b84..afdfee213 100644 --- a/pkg/vm/stackitem/item_test.go +++ b/pkg/vm/stackitem/item_test.go @@ -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 {