Update wdpost_run.go

if some unrecovered sectors can not recovered (such as cache file is missing) , miner should not send message "DeclareFaultsRecovered"
This commit is contained in:
Leo Cheung 2020-07-06 15:52:58 +08:00 committed by GitHub
parent 79e93760b7
commit 4e12c4cb69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,6 +151,15 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, deadline
return xerrors.Errorf("checking unrecovered sectors: %w", err) return xerrors.Errorf("checking unrecovered sectors: %w", err)
} }
// check some unrecovered sectors can not recovered (such as cache file is missing)
sbfCount, err := sbf.Count()
if err != nil {
log.Errorf(" sbf.Count() | %v", err)
} else if sbfCount == 0 {
log.Warnf("unrecovered exists sbf.Count() sectors can not recovery, exit this function.", err)
return nil
}
params := &miner.DeclareFaultsRecoveredParams{ params := &miner.DeclareFaultsRecoveredParams{
Recoveries: []miner.RecoveryDeclaration{{Deadline: deadline, Sectors: sbf}}, Recoveries: []miner.RecoveryDeclaration{{Deadline: deadline, Sectors: sbf}},
} }