From 3c193287640eb9a9bb903e8541d4f7b474e0c277 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 14 Sep 2022 17:38:01 -0400 Subject: [PATCH] Review fixes --- cmd/lotus-miner/actor.go | 12 ++++++------ cmd/lotus-shed/miner-multisig.go | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/lotus-miner/actor.go b/cmd/lotus-miner/actor.go index b1f97d530c1..7b0e81c3b70 100644 --- a/cmd/lotus-miner/actor.go +++ b/cmd/lotus-miner/actor.go @@ -1006,7 +1006,7 @@ var actorProposeChangeBeneficiary = &cli.Command{ } if !cctx.Bool("really-do-it") { - fmt.Println("Pass --really-do-it to actually execute this action") + fmt.Println("Pass --really-do-it to actually execute this action. Review what you're about to approve CAREFULLY please") return nil } @@ -1050,7 +1050,7 @@ var actorProposeChangeBeneficiary = &cli.Command{ return xerrors.Errorf("getting miner info: %w", err) } - if updatedMinerInfo.PendingBeneficiaryTerm == nil { + if updatedMinerInfo.PendingBeneficiaryTerm == nil && updatedMinerInfo.Beneficiary == newAddr { fmt.Println("Beneficiary address successfully changed") } else { fmt.Println("Beneficiary address change awaiting additional confirmations") @@ -1210,7 +1210,7 @@ var actorConfirmChangeBeneficiary = &cli.Command{ } if (cctx.IsSet("existing-beneficiary") && cctx.IsSet("new-beneficiary")) || (!cctx.IsSet("existing-beneficiary") && !cctx.IsSet("new-beneficiary")) { - return lcli.ShowHelp(cctx, fmt.Errorf("must pass exactly one of --existing-beneficiary or --existing-beneficiary")) + return lcli.ShowHelp(cctx, fmt.Errorf("must pass exactly one of --existing-beneficiary or --new-beneficiary")) } var fromAddr address.Address @@ -1232,7 +1232,7 @@ var actorConfirmChangeBeneficiary = &cli.Command{ fmt.Println("Expiration Epoch:", mi.PendingBeneficiaryTerm.NewExpiration) if !cctx.Bool("really-do-it") { - fmt.Println("Pass --really-do-it to actually execute this action") + fmt.Println("Pass --really-do-it to actually execute this action. Review what you're about to approve CAREFULLY please") return nil } @@ -1268,7 +1268,7 @@ var actorConfirmChangeBeneficiary = &cli.Command{ // check it executed successfully if wait.Receipt.ExitCode.IsError() { - return fmt.Errorf("confirm beneficiary change failed") + return fmt.Errorf("confirm beneficiary change failed with code %d", wait.Receipt.ExitCode) } updatedMinerInfo, err := api.StateMinerInfo(ctx, maddr, types.EmptyTSK) @@ -1276,7 +1276,7 @@ var actorConfirmChangeBeneficiary = &cli.Command{ return err } - if updatedMinerInfo.PendingBeneficiaryTerm == nil { + if updatedMinerInfo.PendingBeneficiaryTerm == nil && updatedMinerInfo.Beneficiary == mi.PendingBeneficiaryTerm.NewBeneficiary { fmt.Println("Beneficiary address successfully changed") } else { fmt.Println("Beneficiary address change awaiting additional confirmations") diff --git a/cmd/lotus-shed/miner-multisig.go b/cmd/lotus-shed/miner-multisig.go index 0ea29c50bec..080229a6a13 100644 --- a/cmd/lotus-shed/miner-multisig.go +++ b/cmd/lotus-shed/miner-multisig.go @@ -541,7 +541,7 @@ var mmProposeChangeBeneficiary = &cli.Command{ } if !cctx.Bool("really-do-it") { - fmt.Println("Pass --really-do-it to actually execute this action") + fmt.Println("Pass --really-do-it to actually execute this action. Review what you're about to approve CAREFULLY please") return nil } @@ -705,7 +705,7 @@ var mmConfirmChangeBeneficiary = &cli.Command{ fmt.Println("Expiration Epoch:", mi.PendingBeneficiaryTerm.NewExpiration) if !cctx.Bool("really-do-it") { - fmt.Println("Pass --really-do-it to actually execute this action") + fmt.Println("Pass --really-do-it to actually execute this action. Review what you're about to approve CAREFULLY please") return nil } @@ -734,8 +734,8 @@ var mmConfirmChangeBeneficiary = &cli.Command{ } // check it executed successfully - if wait.Receipt.ExitCode != 0 { - return fmt.Errorf("confirm beneficiary change failed") + if wait.Receipt.ExitCode.IsError() { + return fmt.Errorf("confirm beneficiary change failed with code %d", wait.Receipt.ExitCode) } updatedMinerInfo, err := api.StateMinerInfo(ctx, minerAddr, types.EmptyTSK) @@ -743,7 +743,7 @@ var mmConfirmChangeBeneficiary = &cli.Command{ return err } - if updatedMinerInfo.PendingBeneficiaryTerm == nil { + if updatedMinerInfo.PendingBeneficiaryTerm == nil && updatedMinerInfo.Beneficiary == mi.PendingBeneficiaryTerm.NewBeneficiary { fmt.Println("Beneficiary address successfully changed") } else { fmt.Println("Beneficiary address change awaiting additional confirmations")