From 0ca6e1cbd956001737c86bf74cb57bd610dc9f4a Mon Sep 17 00:00:00 2001 From: Gui Iribarren Date: Mon, 9 Sep 2024 18:32:33 +0200 Subject: [PATCH] add idx.blockTx.Commit --- vochain/indexer/indexer.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vochain/indexer/indexer.go b/vochain/indexer/indexer.go index 1e3608b11..28dc95631 100644 --- a/vochain/indexer/indexer.go +++ b/vochain/indexer/indexer.go @@ -468,6 +468,11 @@ func (idx *Indexer) ReindexBlocks(inTest bool) { if height%10000 == 1 { log.Warnf("reindexing height %d, filling (%s, %x, %x, %x) on top of current %+v", height, b.ChainID, b.Hash(), b.ProposerAddress, b.LastBlockID.Hash, idxBlock) + if err := idx.blockTx.Commit(); err != nil { + log.Errorw(err, "could not commit tx") + } + idx.blockTx = nil + queries = idx.blockTxQueries() } if err == nil && idxBlock.Time != b.Time { log.Errorf("while reindexing blocks, block %d timestamp in db (%s) differs from blockstore (%s), leaving untouched", height, idxBlock.Time, b.Time) @@ -507,6 +512,11 @@ func (idx *Indexer) ReindexBlocks(inTest bool) { } } + if err := idx.blockTx.Commit(); err != nil { + log.Errorw(err, "could not commit tx") + } + idx.blockTx = nil + log.Infow("finished reindexing", "blockStoreBase", idx.App.Node.BlockStore().Base(), "blockStoreHeight", idx.App.Node.BlockStore().Height(),