mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
Continue if archival state is not in DB (#5565)
* Continue if archival state is not availble to generate * Fixed test * Merge branch 'master' into save-blocks-splitslot * Merge refs/heads/master into save-blocks-splitslot
This commit is contained in:
parent
0f08bd288c
commit
480ddb7c3d
@ -18,7 +18,7 @@ func (s *State) saveColdState(ctx context.Context, blockRoot [32]byte, state *st
|
||||
defer span.End()
|
||||
|
||||
if state.Slot()%s.slotsPerArchivedPoint != 0 {
|
||||
return errSlotNonArchivedPoint
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := s.beaconDB.SaveState(ctx, state, blockRoot); err != nil {
|
||||
|
@ -25,8 +25,8 @@ func TestSaveColdState_NonArchivedPoint(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := service.saveColdState(ctx, [32]byte{}, beaconState); err != errSlotNonArchivedPoint {
|
||||
t.Error("Did not get wanted error")
|
||||
if err := service.saveColdState(ctx, [32]byte{}, beaconState); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,18 +56,8 @@ func (s *State) MigrateToCold(ctx context.Context, finalizedSlot uint64, finaliz
|
||||
// Only migrate if current slot is equal to or greater than next archived point slot.
|
||||
if stateSummary.Slot >= nextArchivedPointSlot {
|
||||
if !s.beaconDB.HasState(ctx, r) {
|
||||
recoveredArchivedState, err := s.ComputeStateUpToSlot(ctx, stateSummary.Slot)
|
||||
if err != nil {
|
||||
// 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
|
||||
}
|
||||
}
|
||||
if err := s.beaconDB.SaveArchivedPointRoot(ctx, r, archivedPointIndex); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user