Save finalized checkpoint before migrate to cold (#7055)

* Save finalized checkpoint before migrate to cold
* Save finalized checkpoint before migrate to cold
* Merge branch 'master' into save-checkpoint-first
This commit is contained in:
Preston Van Loon
2020-08-19 14:11:44 -07:00
committed by GitHub
parent 3aa95b9c16
commit 395ea76f44

View File

@@ -226,6 +226,11 @@ func (s *Service) updateFinalized(ctx context.Context, cp *ethpb.Checkpoint) err
return err
}
s.clearInitSyncBlocks()
s.attPool.ClearSeenAtts()
if err := s.beaconDB.SaveFinalizedCheckpoint(ctx, cp); err != nil {
return err
}
s.prevFinalizedCheckpt = s.finalizedCheckpt
s.finalizedCheckpt = cp
@@ -235,9 +240,7 @@ func (s *Service) updateFinalized(ctx context.Context, cp *ethpb.Checkpoint) err
return errors.Wrap(err, "could not migrate to cold")
}
s.attPool.ClearSeenAtts()
return s.beaconDB.SaveFinalizedCheckpoint(ctx, cp)
return nil
}
// ancestor returns the block root of an ancestry block from the input block root.