rpc/request: return error from ExpandArrayIntoScript if any

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2022-02-09 15:38:22 +03:00
parent c72b3f2176
commit 037076f2ee
2 changed files with 5 additions and 1 deletions

View file

@ -97,7 +97,7 @@ func ExpandArrayIntoScript(script *io.BinWriter, slice []Param) error {
return fmt.Errorf("parameter type %v is not supported", fp.Type) return fmt.Errorf("parameter type %v is not supported", fp.Type)
} }
} }
return nil return script.Err
} }
// CreateFunctionInvocationScript creates a script to invoke given contract with // CreateFunctionInvocationScript creates a script to invoke given contract with

View file

@ -135,6 +135,10 @@ func TestExpandArrayIntoScript(t *testing.T) {
{ {
{RawMessage: []byte(`{"type": "Array", "value": null}`)}, {RawMessage: []byte(`{"type": "Array", "value": null}`)},
}, },
{
{RawMessage: []byte(`{"type": "Integer", "value": "` +
new(big.Int).Lsh(big.NewInt(1), 255).String() + `"}`)},
},
} }
for _, c := range errorCases { for _, c := range errorCases {
script := io.NewBufBinWriter() script := io.NewBufBinWriter()