Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
geoff-vball committed Sep 14, 2022
1 parent 84fd51f commit 3c19328
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions cmd/lotus-miner/actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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
}

Expand Down Expand Up @@ -1268,15 +1268,15 @@ 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)
if err != nil {
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")
Expand Down
10 changes: 5 additions & 5 deletions cmd/lotus-shed/miner-multisig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -734,16 +734,16 @@ 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)
if err != nil {
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")
Expand Down

0 comments on commit 3c19328

Please sign in to comment.