restart WaitDeals timers if miner restarts

This commit is contained in:
Aayush Rajasekaran 2020-08-18 05:07:14 -04:00
parent 8cae101c04
commit 37ff876bc6

View File

@ -328,10 +328,25 @@ func (m *Sealing) restartSectors(ctx context.Context) error {
log.Errorf("loading sector list: %+v", err)
}
sd, err := m.getSealDelay()
if err != nil {
return xerrors.Errorf("getting the sealing delay: %w", err)
}
for _, sector := range trackedSectors {
if err := m.sectors.Send(uint64(sector.SectorNumber), SectorRestart{}); err != nil {
log.Errorf("restarting sector %d: %+v", sector.SectorNumber, err)
}
if sector.State == WaitDeals {
if sd > 0 {
timer := time.NewTimer(sd)
go func() {
<-timer.C
m.StartPacking(sector.SectorNumber)
}()
}
}
}
// TODO: Grab on-chain sector set and diff with trackedSectors