[#609] morph/client: Check return state in invoke

Test invocations are used in `Invoke` method to calculate
consumed gas. We can check return code and return error
if panic happened in contract.

This is already done the same way in `TestInvoke` method.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-06-15 16:26:33 +03:00 committed by Alex Vanin
parent 7cead1bc3a
commit 0ec3faefc9

View file

@ -100,6 +100,10 @@ func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string,
return err return err
} }
if resp.State != HaltState {
return &NotHaltStateError{state: resp.State, exception: resp.FaultException}
}
if len(resp.Script) == 0 { if len(resp.Script) == 0 {
return errEmptyInvocationScript return errEmptyInvocationScript
} }