From 1058e3bc4174c60dbf0cd447a9c719e9811c06a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 27 May 2022 18:25:48 +0200 Subject: [PATCH] fix: worker: don't check params with --no-default when not needed --- cmd/lotus-worker/main.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cmd/lotus-worker/main.go b/cmd/lotus-worker/main.go index d7febd5400c..ba4c4caf8c0 100644 --- a/cmd/lotus-worker/main.go +++ b/cmd/lotus-worker/main.go @@ -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) } @@ -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") { @@ -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)