smartcontract: allow to pass nil as parameter to (*Invoker).Call
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
bf871760c6
commit
c0abc61613
2 changed files with 7 additions and 0 deletions
|
@ -360,6 +360,8 @@ func NewParameterFromValue(value interface{}) (Parameter, error) {
|
||||||
}
|
}
|
||||||
result.Type = ArrayType
|
result.Type = ArrayType
|
||||||
result.Value = arr
|
result.Value = arr
|
||||||
|
case nil:
|
||||||
|
result.Type = AnyType
|
||||||
default:
|
default:
|
||||||
return result, fmt.Errorf("unsupported parameter %T", value)
|
return result, fmt.Errorf("unsupported parameter %T", value)
|
||||||
}
|
}
|
||||||
|
|
|
@ -690,6 +690,11 @@ func TestParameterFromValue(t *testing.T) {
|
||||||
expType: PublicKeyType,
|
expType: PublicKeyType,
|
||||||
expVal: pk2.PublicKey().Bytes(),
|
expVal: pk2.PublicKey().Bytes(),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
value: nil,
|
||||||
|
expType: AnyType,
|
||||||
|
expVal: nil,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: [][]byte{{1, 2, 3}, {3, 2, 1}},
|
value: [][]byte{{1, 2, 3}, {3, 2, 1}},
|
||||||
expType: ArrayType,
|
expType: ArrayType,
|
||||||
|
|
Loading…
Reference in a new issue