From 08b5f29e1640bc8a7203068d1d82c4a2e03d4d86 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Jun 2021 16:47:57 +0300 Subject: [PATCH] [#609] morph/client: Make halt state error private Signed-off-by: Alex Vanin --- pkg/morph/client/client.go | 8 ++++---- pkg/morph/client/notary.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index fcc6aebd6..6c686b4c2 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -51,11 +51,11 @@ var ErrNilClient = errors.New("client is nil") // HaltState returned if TestInvoke function processed without panic. const HaltState = "HALT" -type NotHaltStateError struct { +type notHaltStateError struct { state, exception string } -func (e *NotHaltStateError) Error() string { +func (e *notHaltStateError) Error() string { return fmt.Sprintf( "chain/client: contract execution finished with state %s; exception: %s", e.state, @@ -101,7 +101,7 @@ func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, } if resp.State != HaltState { - return &NotHaltStateError{state: resp.State, exception: resp.FaultException} + return ¬HaltStateError{state: resp.State, exception: resp.FaultException} } if len(resp.Script) == 0 { @@ -151,7 +151,7 @@ func (c *Client) TestInvoke(contract util.Uint160, method string, args ...interf } if val.State != HaltState { - return nil, &NotHaltStateError{state: val.State, exception: val.FaultException} + return nil, ¬HaltStateError{state: val.State, exception: val.FaultException} } return val.Stack, nil diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index f523b057c..ea5dfe831 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -244,7 +244,7 @@ func (c *Client) notaryInvoke(committee bool, contract util.Uint160, method stri // check invocation state if test.State != HaltState { - return &NotHaltStateError{state: test.State, exception: test.FaultException} + return ¬HaltStateError{state: test.State, exception: test.FaultException} } // if test invocation failed, then return error