Skip to content

Commit

Permalink
add idx.blockTx.Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
altergui committed Sep 9, 2024
1 parent 7d4280f commit 0ca6e1c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions vochain/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 0ca6e1c

Please sign in to comment.