Migration should not fail process block routine (#5557)

* Continue rather than fail
* Merge branch 'master' into migrate-should-not-fail-block
* Merge refs/heads/master into migrate-should-not-fail-block
This commit is contained in:
terence tsao 2020-04-21 07:44:43 -07:00 committed by GitHub
parent c69f561fb9
commit 199c50be47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -58,7 +58,11 @@ func (s *State) MigrateToCold(ctx context.Context, finalizedSlot uint64, finaliz
if !s.beaconDB.HasState(ctx, r) {
recoveredArchivedState, err := s.ComputeStateUpToSlot(ctx, stateSummary.Slot)
if err != nil {
return err
// For whatever reason if node fails to generate archived state of a certain slot,
// a node should just skip that slot rather than fail to whole process block routine.
// Missing an archived point of a certain slot is less of a deal than failing process block.
log.Warnf("Unable to generate archived state: %v", err)
continue
}
if err := s.beaconDB.SaveState(ctx, recoveredArchivedState.Copy(), r); err != nil {
return err

View File

@ -284,7 +284,7 @@ func (s *State) lastSavedState(ctx context.Context, slot uint64) (*state.BeaconS
lastSaved, err := s.beaconDB.HighestSlotStatesBelow(ctx, slot+1)
if err != nil {
return nil, errUnknownState
return nil, err
}
// Given this is used to query canonical state. There should only be one saved canonical block of a given slot.