Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 9 additions & 3 deletions rocketpool-cli/node/claim-unclaimed-rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,27 @@ func claimUnclaimedRewards(yes bool) error {
fmt.Printf("The node's withdrawal address is %s\n", status.PrimaryWithdrawalAddress)
if status.UnclaimedRewards != nil && status.UnclaimedRewards.Cmp(big.NewInt(0)) > 0 {
fmt.Printf("You have %.6f ETH in unclaimed rewards.\n", math.RoundDown(math.WeiToEth(status.UnclaimedRewards), 6))
fmt.Printf("Your node %s's rewards were distributed, but the withdrawal address (at the time of distribution) was unable to accept ETH. ",
fmt.Printf("Your node %s has rewards that were distributed to its unclaimed rewards balance instead of its withdrawal address. ",
color.LightBlue(status.AccountAddress.String()))
fmt.Println("Before continuing, please use the command `rocketpool node set-primary-withdrawal-address` to configure an address that can accept ETH")
fmt.Println("This happens whenever your fee distributor is distributed by anyone other than your node or withdrawal address.")
fmt.Println("Claiming will send them to your current withdrawal address.")
} else {
fmt.Println("You have no unclaimed rewards.")
fmt.Println("Unclaimed rewards occur when a withdrawal address cannot accept ETH during distribution.")
fmt.Println("Unclaimed rewards occur when your fee distributor is distributed by anyone other than your node or withdrawal address.")
fmt.Println("If you have unclaimed rewards in the future, you can use this command to claim them.")
return nil
}

// Check the node can claim unclaimed rewards
canClaim, err := rp.CanClaimUnclaimedRewards(status.AccountAddress)
if err != nil {
fmt.Println("Could not claim unclaimed rewards. If your current withdrawal address cannot accept ETH, use `rocketpool node set-primary-withdrawal-address` to reconfigure your withdrawal address.")
return err
}
if !canClaim.CanClaim {
fmt.Println("You have no unclaimed rewards.")
return nil
}

// Assign max fees
err = gas.AssignMaxFeeAndLimit(canClaim.GasLimits, rp, yes)
Expand Down
6 changes: 3 additions & 3 deletions rocketpool/api/node/claim-unclaimed-rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ func canClaimUnclaimedRewards(c *cli.Command, nodeAddress common.Address) (*api.
return nil, err
}

if unclaimedRewards != nil {
response.CanClaim = false
response.CanClaim = unclaimedRewards != nil && unclaimedRewards.Sign() > 0
if !response.CanClaim {
return &response, nil
}

// Get gas estimate
Expand All @@ -46,7 +47,6 @@ func canClaimUnclaimedRewards(c *cli.Command, nodeAddress common.Address) (*api.
if err != nil {
return nil, err
}
response.CanClaim = true

return &response, nil

Expand Down
Loading