From 08e9e29dff7d70cec8ee65a7208f0a5780691b5b Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Sat, 5 Aug 2023 10:47:10 +0300 Subject: [PATCH] subscriber: fix off-by-one in awaitHeight() Block count is literally a block counter, while block height is the height written in the block. For block zero the height is zero while we have one block in the chain and therefore the count is one. Persistent store operates with heights, therefore comparison should be adjusted by one. Signed-off-by: Roman Khimov --- pkg/morph/subscriber/subscriber.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/morph/subscriber/subscriber.go b/pkg/morph/subscriber/subscriber.go index e9b3bca21d..21f91d2fb9 100644 --- a/pkg/morph/subscriber/subscriber.go +++ b/pkg/morph/subscriber/subscriber.go @@ -332,7 +332,7 @@ func awaitHeight(cli *client.Client, startFrom uint32) error { return fmt.Errorf("could not get block height: %w", err) } - if height < startFrom { + if height < startFrom+1 { return fmt.Errorf("RPC block counter %d didn't reach expected height %d", height, startFrom) }