Skip to content

Commit

Permalink
Merge pull request #8741 from filecoin-project/fix/worker-nodefault-p…
Browse files Browse the repository at this point in the history
…aram-checks

fix: worker: don't check params with --no-default when not needed
  • Loading branch information
magik6k authored May 27, 2022
2 parents d38cd87 + 1058e3b commit ed0c305
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions cmd/lotus-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,20 +293,17 @@ var runCmd = &cli.Command{
return err
}

if cctx.Bool("commit") || cctx.Bool("prove-replica-update2") || cctx.Bool("windowpost") || cctx.Bool("winningpost") {
if err := paramfetch.GetParams(ctx, build.ParametersJSON(), build.SrsJSON(), uint64(ssize)); err != nil {
return xerrors.Errorf("get params: %w", err)
}
}

var taskTypes []sealtasks.TaskType
var workerType string
var needParams bool

if cctx.Bool("windowpost") {
needParams = true
workerType = sealtasks.WorkerWindowPoSt
taskTypes = append(taskTypes, sealtasks.TTGenerateWindowPoSt)
}
if cctx.Bool("winningpost") {
needParams = true
workerType = sealtasks.WorkerWinningPoSt
taskTypes = append(taskTypes, sealtasks.TTGenerateWinningPoSt)
}
Expand All @@ -332,12 +329,14 @@ var runCmd = &cli.Command{
taskTypes = append(taskTypes, sealtasks.TTPreCommit2)
}
if (workerType == sealtasks.WorkerSealing || cctx.IsSet("commit")) && cctx.Bool("commit") {
needParams = true
taskTypes = append(taskTypes, sealtasks.TTCommit2)
}
if (workerType == sealtasks.WorkerSealing || cctx.IsSet("replica-update")) && cctx.Bool("replica-update") {
taskTypes = append(taskTypes, sealtasks.TTReplicaUpdate)
}
if (workerType == sealtasks.WorkerSealing || cctx.IsSet("prove-replica-update2")) && cctx.Bool("prove-replica-update2") {
needParams = true
taskTypes = append(taskTypes, sealtasks.TTProveReplicaUpdate2)
}
if (workerType == sealtasks.WorkerSealing || cctx.IsSet("regen-sector-key")) && cctx.Bool("regen-sector-key") {
Expand All @@ -357,6 +356,12 @@ var runCmd = &cli.Command{
}
}

if needParams {
if err := paramfetch.GetParams(ctx, build.ParametersJSON(), build.SrsJSON(), uint64(ssize)); err != nil {
return xerrors.Errorf("get params: %w", err)
}
}

// Open repo

repoPath := cctx.String(FlagWorkerRepo)
Expand Down

0 comments on commit ed0c305

Please sign in to comment.