From ee76db9ff20fd61b2579838b8ecacd40ff987373 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Mon, 22 Mar 2021 12:21:48 +0300 Subject: [PATCH] rpc: refactor (*Client).AddNetworkFee errors handling core.ErrVerificationFailed is not very informative. Also removing it from RPC client allows to get rid of `core` dependency in the `client` package, which is needed for the next commit. --- pkg/rpc/client/rpc.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/rpc/client/rpc.go b/pkg/rpc/client/rpc.go index 1308d9848..a70a10242 100644 --- a/pkg/rpc/client/rpc.go +++ b/pkg/rpc/client/rpc.go @@ -6,7 +6,6 @@ import ( "fmt" "github.com/nspcc-dev/neo-go/pkg/config/netmode" - "github.com/nspcc-dev/neo-go/pkg/core" "github.com/nspcc-dev/neo-go/pkg/core/block" "github.com/nspcc-dev/neo-go/pkg/core/fee" "github.com/nspcc-dev/neo-go/pkg/core/native" @@ -781,8 +780,11 @@ func (c *Client) AddNetworkFee(tx *transaction.Transaction, extraFee int64, accs return fmt.Errorf("result stack length should be equal to 1, got %d", l) } r, err := topIntFromStack(res.Stack) - if err != nil || r == 0 { - return core.ErrVerificationFailed + if err != nil { + return fmt.Errorf("signer #%d: failed to get `verify` result from stack: %w", i, err) + } + if r == 0 { + return fmt.Errorf("signer #%d: `verify` returned `false`", i) } tx.NetworkFee += res.GasConsumed size += io.GetVarSize([]byte{}) * 2 // both scripts are empty