[#1496] morph: Merge InvokeRes
and WaitParams
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
b65874d1c3
commit
acd5babd86
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 {
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue