save the warm up epoch only if successful in warming up

This commit is contained in:
vyzo 2021-06-17 00:21:16 +03:00
parent 9b6448518c
commit 421f05eab9

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
}