From 7f782b136ee470f0e14ba67f5f0c7ed6aec3b9a7 Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Thu, 27 Jun 2019 16:54:19 +0800 Subject: [PATCH] core: prevent reverting valid section when reorg happens --- core/chain_indexer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/chain_indexer.go b/core/chain_indexer.go index f91e3fd909..455f9f093a 100644 --- a/core/chain_indexer.go +++ b/core/chain_indexer.go @@ -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