save blocks (#6578)

This commit is contained in:
Nishant Das 2020-07-13 21:33:45 +08:00 committed by GitHub
parent ec800bac7c
commit f2b4f91419
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,6 +201,13 @@ func (s *Service) updateJustified(ctx context.Context, state *stateTrie.BeaconSt
}
func (s *Service) updateFinalized(ctx context.Context, cp *ethpb.Checkpoint) error {
// Blocks need to be saved so that we can retrieve finalized block from
// DB when migrating states.
if err := s.beaconDB.SaveBlocks(ctx, s.getInitSyncBlocks()); err != nil {
return err
}
s.clearInitSyncBlocks()
s.prevFinalizedCheckpt = s.finalizedCheckpt
s.finalizedCheckpt = cp