From 345d48d051cea2fa95737302773e1ab352beb256 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 18 Oct 2022 16:42:03 +0300 Subject: [PATCH] rpc: improve WS-based transaction awaiting Subscribe only for required aers. --- pkg/rpcclient/actor/waiter.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/rpcclient/actor/waiter.go b/pkg/rpcclient/actor/waiter.go index 5623e16de..9085d9045 100644 --- a/pkg/rpcclient/actor/waiter.go +++ b/pkg/rpcclient/actor/waiter.go @@ -156,7 +156,7 @@ func (a *Actor) waitWithWSWaiter(c RPCEventWaiter, h util.Uint256, vub uint32) ( waitErr = fmt.Errorf(errFmt, errArgs...) } }() - txsID, err := c.SubscribeForTransactionExecutionsWithChan(nil, nil, rcvr) + txsID, err := c.SubscribeForTransactionExecutionsWithChan(nil, &h, rcvr) if err != nil { wsWaitErr = fmt.Errorf("failed to subscribe for execution results: %w", err) return @@ -182,11 +182,8 @@ func (a *Actor) waitWithWSWaiter(c RPCEventWaiter, h util.Uint256, vub uint32) ( waitErr = ErrTxNotAccepted return case neorpc.ExecutionEventID: - aer := ntf.Value.(*state.AppExecResult) - if aer.Container.Equals(h) { - res = aer - return - } + res = ntf.Value.(*state.AppExecResult) + return case neorpc.MissedEventID: // We're toast, retry with non-ws client. wsWaitErr = errors.New("some event was missed")