Merge pull request #3067 from nspcc-dev/allow-nil-arg

smartcontract: allow to pass nil as parameter to (*Invoker).Call
This commit is contained in:
Roman Khimov 2023-07-21 14:51:10 +03:00 committed by GitHub
commit 7a7d0a06ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -360,6 +360,8 @@ func NewParameterFromValue(value any) (Parameter, error) {
}
result.Type = ArrayType
result.Value = arr
case nil:
result.Type = AnyType
default:
return result, fmt.Errorf("unsupported parameter %T", value)
}

View file

@ -690,6 +690,11 @@ func TestParameterFromValue(t *testing.T) {
expType: PublicKeyType,
expVal: pk2.PublicKey().Bytes(),
},
{
value: nil,
expType: AnyType,
expVal: nil,
},
{
value: [][]byte{{1, 2, 3}, {3, 2, 1}},
expType: ArrayType,