From 9336be3a3a88702f2bf5cc4e02cdbced8e5db361 Mon Sep 17 00:00:00 2001 From: Gui Iribarren Date: Mon, 9 Sep 2024 17:55:56 +0200 Subject: [PATCH] (lts-backport) don't WaitUntilSync, just until BlockStore --- vochain/indexer/indexer.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/vochain/indexer/indexer.go b/vochain/indexer/indexer.go index c095c7e00..9574bbf06 100644 --- a/vochain/indexer/indexer.go +++ b/vochain/indexer/indexer.go @@ -433,7 +433,18 @@ func (idx *Indexer) AfterSyncBootstrap(inTest bool) { // ReindexBlocks reindexes all blocks found in blockstore func (idx *Indexer) ReindexBlocks(inTest bool) { if !inTest { - <-idx.App.WaitUntilSynced() + done := make(chan any) + go func() { + for idx.App == nil || + idx.App.Node == nil || + idx.App.Node.BlockStore() == nil { + log.Info("waiting for reindexing") + time.Sleep(time.Second * 1) + } + close(done) + }() + + <-done } // Note that holding blockMu means new votes aren't added until the reindex finishes.