forked from TrueCloudLab/frostfs-node
[#1506] morph: Simplify WaitTxHalt() signature
Avoid dependency on `morph/client` package because of `InvokeRes`. Make signature resemble `WaitAny()` method of `waiter.Waiter` from neo-go. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
85af6bcd5c
commit
198aaebc94
3 changed files with 4 additions and 4 deletions
|
@ -151,7 +151,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 {
|
func waitNotaryDeposit(ctx context.Context, c *cfg, tx util.Uint256, vub uint32) error {
|
||||||
if err := c.cfgMorph.client.WaitTxHalt(ctx, client.InvokeRes{Hash: tx, VUB: vub}); err != nil {
|
if err := c.cfgMorph.client.WaitTxHalt(ctx, vub, tx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -423,7 +423,7 @@ func (c *cfg) updateNetMapState(ctx context.Context, stateSetter func(*nmClient.
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return c.cfgNetmap.wrapper.Morph().WaitTxHalt(ctx, res)
|
return c.cfgNetmap.wrapper.Morph().WaitTxHalt(ctx, res.VUB, res.Hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
type netInfo struct {
|
type netInfo struct {
|
||||||
|
|
|
@ -33,13 +33,13 @@ func (w *waiterClient) GetVersion() (*result.Version, error) {
|
||||||
|
|
||||||
// WaitTxHalt waits until transaction with the specified hash persists on the blockchain.
|
// WaitTxHalt waits until transaction with the specified hash persists on the blockchain.
|
||||||
// It also checks execution result to finish in HALT state.
|
// It also checks execution result to finish in HALT state.
|
||||||
func (c *Client) WaitTxHalt(ctx context.Context, p InvokeRes) error {
|
func (c *Client) WaitTxHalt(ctx context.Context, vub uint32, h util.Uint256) error {
|
||||||
w, err := waiter.NewPollingBased(&waiterClient{c: c})
|
w, err := waiter.NewPollingBased(&waiterClient{c: c})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("create tx waiter: %w", err)
|
return fmt.Errorf("create tx waiter: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := w.WaitAny(ctx, p.VUB, p.Hash)
|
res, err := w.WaitAny(ctx, vub, h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("wait until tx persists: %w", err)
|
return fmt.Errorf("wait until tx persists: %w", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue