mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-22 19:29:39 +00:00
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.
This commit is contained in:
parent
a727ba75c6
commit
ee76db9ff2
1 changed files with 5 additions and 3 deletions
|
@ -6,7 +6,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
"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/block"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/fee"
|
"github.com/nspcc-dev/neo-go/pkg/core/fee"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/native"
|
"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)
|
return fmt.Errorf("result stack length should be equal to 1, got %d", l)
|
||||||
}
|
}
|
||||||
r, err := topIntFromStack(res.Stack)
|
r, err := topIntFromStack(res.Stack)
|
||||||
if err != nil || r == 0 {
|
if err != nil {
|
||||||
return core.ErrVerificationFailed
|
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
|
tx.NetworkFee += res.GasConsumed
|
||||||
size += io.GetVarSize([]byte{}) * 2 // both scripts are empty
|
size += io.GetVarSize([]byte{}) * 2 // both scripts are empty
|
||||||
|
|
Loading…
Reference in a new issue