good morning!!!!

Skip to content
Snippets Groups Projects
Commit 802074cb authored by Gary Rong's avatar Gary Rong Committed by Péter Szilágyi
Browse files

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.
parent 32273df0
No related branches found
No related tags found
No related merge requests found
...@@ -418,7 +418,7 @@ func (c *ChainIndexer) processSection(section uint64, lastHead common.Hash) (com ...@@ -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 // actual canonical chain and rolls back reorged sections if necessary to ensure that stored
// sections are all valid // sections are all valid
func (c *ChainIndexer) verifyLastHead() { 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) { if c.SectionHead(c.storedSections-1) == rawdb.ReadCanonicalHash(c.chainDb, c.storedSections*c.sectionSize-1) {
return return
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment