save the warm up epoch only if successful in warming up

This commit is contained in:
vyzo
2021-07-04 18:38:28 +03:00
parent 9b6448518c
commit 421f05eab9
+7 -7
View File
@@ -492,13 +492,6 @@ func (s *SplitStore) warmup(curTs *types.TipSet) error {
log.Infow("warm up done", "took", time.Since(start))
}()
// save the warmup epoch
s.warmupEpoch = curTs.Height()
err = s.ds.Put(warmupEpochKey, epochToBytes(s.warmupEpoch))
if err != nil {
return xerrors.Errorf("error saving warm up epoch: %w")
}
return nil
}
@@ -641,6 +634,13 @@ func (s *SplitStore) doWarmup(curTs *types.TipSet) error {
log.Warnf("error saving mark set size: %s", err)
}
// save the warmup epoch
err = s.ds.Put(warmupEpochKey, epochToBytes(epoch))
if err != nil {
return xerrors.Errorf("error saving warm up epoch: %w", err)
}
s.warmupEpoch = epoch
return nil
}