forked from TrueCloudLab/frostfs-node
[#1496] morph: Return InvokeRes
from all invoke*() methods
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
69c63006da
commit
b65874d1c3
5 changed files with 25 additions and 27 deletions
|
@ -180,7 +180,7 @@ func wrapFrostFSError(err error) error {
|
|||
// Invoke invokes contract method by sending transaction into blockchain.
|
||||
// Returns valid until block value.
|
||||
// Supported args types: int64, string, util.Uint160, []byte and bool.
|
||||
func (c *Client) Invoke(ctx context.Context, contract util.Uint160, fee fixedn.Fixed8, method string, args ...any) (uint32, error) {
|
||||
func (c *Client) Invoke(ctx context.Context, contract util.Uint160, fee fixedn.Fixed8, method string, args ...any) (InvokeRes, error) {
|
||||
start := time.Now()
|
||||
success := false
|
||||
defer func() {
|
||||
|
@ -191,12 +191,12 @@ func (c *Client) Invoke(ctx context.Context, contract util.Uint160, fee fixedn.F
|
|||
defer c.switchLock.RUnlock()
|
||||
|
||||
if c.inactive {
|
||||
return 0, ErrConnectionLost
|
||||
return InvokeRes{}, ErrConnectionLost
|
||||
}
|
||||
|
||||
txHash, vub, err := c.rpcActor.SendTunedCall(contract, method, nil, addFeeCheckerModifier(int64(fee)), args...)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("could not invoke %s: %w", method, err)
|
||||
return InvokeRes{}, fmt.Errorf("could not invoke %s: %w", method, err)
|
||||
}
|
||||
|
||||
c.logger.Debug(ctx, logs.ClientNeoClientInvoke,
|
||||
|
@ -205,7 +205,7 @@ func (c *Client) Invoke(ctx context.Context, contract util.Uint160, fee fixedn.F
|
|||
zap.Stringer("tx_hash", txHash.Reverse()))
|
||||
|
||||
success = true
|
||||
return vub, nil
|
||||
return InvokeRes{Hash: txHash, VUB: vub}, nil
|
||||
}
|
||||
|
||||
// TestInvokeIterator invokes contract method returning an iterator and executes cb on each element.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue