From acd5babd86ec98f227a30573497af0cdcd53df87 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 14 Nov 2024 10:04:02 +0300 Subject: [PATCH] [#1496] morph: Merge `InvokeRes` and `WaitParams` Signed-off-by: Evgenii Stratonikov --- cmd/frostfs-node/morph.go | 2 +- pkg/morph/client/waiter.go | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/cmd/frostfs-node/morph.go b/cmd/frostfs-node/morph.go index 4e33ad6e2..67d2d1c06 100644 --- a/cmd/frostfs-node/morph.go +++ b/cmd/frostfs-node/morph.go @@ -161,7 +161,7 @@ func makeNotaryDeposit(ctx context.Context, c *cfg) (util.Uint256, uint32, error } func waitNotaryDeposit(ctx context.Context, c *cfg, tx util.Uint256, vub uint32) error { - if err := c.cfgMorph.client.WaitTxHalt(ctx, client.WaitParams{Hash: tx, ValidUntilBlock: vub}); err != nil { + if err := c.cfgMorph.client.WaitTxHalt(ctx, client.InvokeRes{Hash: tx, VUB: vub}); err != nil { return err } diff --git a/pkg/morph/client/waiter.go b/pkg/morph/client/waiter.go index 8211deac4..962ec1bc2 100644 --- a/pkg/morph/client/waiter.go +++ b/pkg/morph/client/waiter.go @@ -11,12 +11,6 @@ import ( "github.com/nspcc-dev/neo-go/pkg/vm/vmstate" ) -// WaitParams represents transaction to wait for. -type WaitParams struct { - Hash util.Uint256 - ValidUntilBlock uint32 -} - type waiterClient struct { c *Client } @@ -39,13 +33,13 @@ func (w *waiterClient) GetVersion() (*result.Version, error) { // WaitTxHalt waits until transaction with the specified hash persists on the blockchain. // It also checks execution result to finish in HALT state. -func (c *Client) WaitTxHalt(ctx context.Context, p WaitParams) error { +func (c *Client) WaitTxHalt(ctx context.Context, p InvokeRes) error { w, err := waiter.NewPollingBased(&waiterClient{c: c}) if err != nil { return fmt.Errorf("create tx waiter: %w", err) } - res, err := w.WaitAny(ctx, p.ValidUntilBlock, p.Hash) + res, err := w.WaitAny(ctx, p.VUB, p.Hash) if err != nil { return fmt.Errorf("wait until tx persists: %w", err) }