diff options
author | gary rong <garyrong0905@gmail.com> | 2019-07-03 16:18:48 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-07-03 16:18:48 +0800 |
commit | 802074cba9f23b2e404c2e542cc696547d0017dd (patch) | |
tree | 3b659e61a043f272f2e5621c842d958315b59af8 /core | |
parent | 32273df0eafbbd829b7e6b6758730a5bb0ab59cb (diff) | |
download | go-tangerine-802074cba9f23b2e404c2e542cc696547d0017dd.tar.gz go-tangerine-802074cba9f23b2e404c2e542cc696547d0017dd.tar.zst go-tangerine-802074cba9f23b2e404c2e542cc696547d0017dd.zip |
core: fix chain indexer (#19786)
This PR fixes an issue in chain indexer. Currently chain indexer will
validate whether the stored data is canonical by comparing section head
and canonical hash. But the header of the checkpoint may not exist in
the database. We should skip validation for sections below the
checkpoint.
Diffstat (limited to 'core')
-rw-r--r-- | core/chain_indexer.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/chain_indexer.go b/core/chain_indexer.go index c82febb54..c0c2c4f7f 100644 --- a/core/chain_indexer.go +++ b/core/chain_indexer.go @@ -418,7 +418,7 @@ func (c *ChainIndexer) processSection(section uint64, lastHead common.Hash) (com // actual canonical chain and rolls back reorged sections if necessary to ensure that stored // sections are all valid func (c *ChainIndexer) verifyLastHead() { - for c.storedSections > 0 { + for c.storedSections > 0 && c.storedSections > c.checkpointSections { if c.SectionHead(c.storedSections-1) == rawdb.ReadCanonicalHash(c.chainDb, c.storedSections*c.sectionSize-1) { return } |