[#1496] morph: Merge InvokeRes
and WaitParams
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
1f280c1a64
commit
f8b217cdb0
2 changed files with 3 additions and 9 deletions
|
@ -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 {
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,6 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/vmstate"
|
"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 {
|
type waiterClient struct {
|
||||||
c *Client
|
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.
|
// 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 WaitParams) error {
|
func (c *Client) WaitTxHalt(ctx context.Context, p InvokeRes) error {
|
||||||
w, err := waiter.NewPollingBased(&waiterClient{c: c})
|
w, err := waiter.NewPollingBased(&waiterClient{c: c})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not create notary deposit waiter: %w", err)
|
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 {
|
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