From 0ec3faefc9e001e7540a090678dcfb1e49dd6e26 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Jun 2021 16:26:33 +0300 Subject: [PATCH] [#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 --- pkg/morph/client/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index c8a13a0c2..fcc6aebd6 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -100,6 +100,10 @@ func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, return err } + if resp.State != HaltState { + return &NotHaltStateError{state: resp.State, exception: resp.FaultException} + } + if len(resp.Script) == 0 { return errEmptyInvocationScript }