mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-28 23:27:36 +00:00
rpc: improve WS-based transaction awaiting
Subscribe only for required aers.
This commit is contained in:
parent
d7c1f3eac7
commit
345d48d051
1 changed files with 3 additions and 6 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue