Skip to content

Commit

Permalink
small fix for reorg detection
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Aug 7, 2023
1 parent 7b3332a commit 1575bb6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,9 @@ func (indexer *Indexer) processHeadBlock(slot uint64, header *rpctypes.StandardV
indexer.state.highestCachedSlot = int64(slot)
}

if indexer.state.lastHeadRoot != nil && !bytes.Equal(indexer.state.lastHeadRoot, header.Data.Header.Message.ParentRoot) {
if (indexer.state.lastHeadRoot != nil && !bytes.Equal(indexer.state.lastHeadRoot, header.Data.Header.Message.ParentRoot)) || blockInfo.Orphaned {
// chain did not proceed as usual, check for reorg
// reorg detected
logger.Debugf("Unusual chain progress, check for reorg %v (%v)", slot, header.Data.Root)
var canonicalBlock *BlockInfo = blockInfo

// walk backwards, mark all blocks that are not the parent of canonicalBlock as orphaned
Expand Down

0 comments on commit 1575bb6

Please sign in to comment.