Patch Initial Sync For Non Finalized Blocks (#9452)

* fix for now

* off by 1

* preston's review
This commit is contained in:
Nishant Das
2021-08-24 23:20:45 +08:00
committed by GitHub
parent a49c0f19ae
commit 114a14a4b6

View File

@@ -304,7 +304,15 @@ func (s *Service) isProcessedBlock(ctx context.Context, blk block.SignedBeaconBl
if err != nil {
return false
}
if blk.Block().Slot() <= finalizedSlot || (s.cfg.DB.HasBlock(ctx, blkRoot) || s.cfg.Chain.HasInitSyncBlock(blkRoot)) {
// If block is before our finalized checkpoint
// we do not process it.
if blk.Block().Slot() <= finalizedSlot {
return true
}
blockExistsInDB := s.cfg.DB.HasBlock(ctx, blkRoot) || s.cfg.Chain.HasInitSyncBlock(blkRoot)
// If block exists in our db and is before or equal to our current head
// we ignore it.
if blockExistsInDB && s.cfg.Chain.HeadSlot() >= blk.Block().Slot() {
return true
}
return false