core: prevent reverting valid section when reorg happens

This commit is contained in:
rjl493456442 2019-06-27 16:54:19 +08:00
parent 48c9d284c1
commit 7f782b136e

View file

@ -243,7 +243,7 @@ func (c *ChainIndexer) newHead(head uint64, reorg bool) {
// If a reorg happened, invalidate all sections until that point
if reorg {
// Revert the known section number to the reorg point
known := head / c.sectionSize
known := (head + 1) / c.sectionSize
stored := known
if known < c.checkpointSections {
known = 0