forked from TrueCloudLab/neoneo-go
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...)
|
waitErr = fmt.Errorf(errFmt, errArgs...)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
txsID, err := c.SubscribeForTransactionExecutionsWithChan(nil, nil, rcvr)
|
txsID, err := c.SubscribeForTransactionExecutionsWithChan(nil, &h, rcvr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wsWaitErr = fmt.Errorf("failed to subscribe for execution results: %w", err)
|
wsWaitErr = fmt.Errorf("failed to subscribe for execution results: %w", err)
|
||||||
return
|
return
|
||||||
|
@ -182,11 +182,8 @@ func (a *Actor) waitWithWSWaiter(c RPCEventWaiter, h util.Uint256, vub uint32) (
|
||||||
waitErr = ErrTxNotAccepted
|
waitErr = ErrTxNotAccepted
|
||||||
return
|
return
|
||||||
case neorpc.ExecutionEventID:
|
case neorpc.ExecutionEventID:
|
||||||
aer := ntf.Value.(*state.AppExecResult)
|
res = ntf.Value.(*state.AppExecResult)
|
||||||
if aer.Container.Equals(h) {
|
return
|
||||||
res = aer
|
|
||||||
return
|
|
||||||
}
|
|
||||||
case neorpc.MissedEventID:
|
case neorpc.MissedEventID:
|
||||||
// We're toast, retry with non-ws client.
|
// We're toast, retry with non-ws client.
|
||||||
wsWaitErr = errors.New("some event was missed")
|
wsWaitErr = errors.New("some event was missed")
|
||||||
|
|
Loading…
Reference in a new issue