From 581168783607ad01988eca18c78a98d913b1359d Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Wed, 26 Oct 2022 10:31:25 +0300 Subject: [PATCH] rpc: fix bug in Actor's waiter Execution events are followed by block events, not vise versa, thus, we can wait until VUB block to be accepted to be sure that transaction wasn't accepted to chain. --- pkg/rpcclient/actor/waiter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/rpcclient/actor/waiter.go b/pkg/rpcclient/actor/waiter.go index 4eae26f81..0e86aebb1 100644 --- a/pkg/rpcclient/actor/waiter.go +++ b/pkg/rpcclient/actor/waiter.go @@ -244,8 +244,8 @@ func (w *EventWaiter) WaitAny(ctx context.Context, vub uint32, hashes ...util.Ui close(aerRcvr) } }() - // Execution event follows the block event, thus wait until the block next to the VUB to be sure. - since := vub + 1 + // Execution event precedes the block event, thus wait until the VUB-th block to be sure. + since := vub blocksID, err := w.ws.ReceiveBlocks(&neorpc.BlockFilter{Since: &since}, bRcvr) if err != nil { wsWaitErr = fmt.Errorf("failed to subscribe for new blocks: %w", err)