morph: Merge InvokeRes and WaitParams

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-11-14 10:04:02 +03:00
parent ddd8f2009d
commit 9a4bb0a23b
Signed by: fyrchik
SSH key fingerprint: SHA256:m/TTwCzjnRkXgnzEx9X92ccxy1CcVeinOgDb3NPWWmg
2 changed files with 3 additions and 9 deletions

View file

@ -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
}

View file

@ -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("could not create notary deposit 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)
}