Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cli: Add option to terminate sectors from worker address #9291

Merged
merged 1 commit into from
Sep 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion cmd/lotus-shed/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ var terminateSectorCmd = &cli.Command{
Name: "really-do-it",
Usage: "pass this flag if you know what you are doing",
},
&cli.StringFlag{
Name: "from",
Usage: "specify the address to send the terminate message from",
},
},
Action: func(cctx *cli.Context) error {
if cctx.Args().Len() < 1 {
Expand Down Expand Up @@ -137,8 +141,19 @@ var terminateSectorCmd = &cli.Command{
return xerrors.Errorf("serializing params: %w", err)
}

var fromAddr address.Address
if from := cctx.String("from"); from != "" {
var err error
fromAddr, err = address.NewFromString(from)
if err != nil {
return fmt.Errorf("parsing address %s: %w", from, err)
}
} else {
fromAddr = mi.Worker
}

smsg, err := nodeApi.MpoolPushMessage(ctx, &types.Message{
From: mi.Owner,
From: fromAddr,
To: maddr,
Method: builtin.MethodsMiner.TerminateSectors,

Expand Down