Skip to content

Commit

Permalink
fix: expected withdrawable stake error
Browse files Browse the repository at this point in the history
  • Loading branch information
martinconic committed Sep 4, 2024
1 parent 21c2c73 commit a64053b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/check/stake/stake.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,13 @@ func expectWithdrawableStake(ctx context.Context, client *bee.Client, expected *
return fmt.Errorf("get stake amount: %w", err)
}

if withdrawable.Cmp(expected) != 0 {
return fmt.Errorf("expected withdrawable stake to be %d, got: %d", expected, withdrawable)
if (expected.Cmp(zero) == 0 && withdrawable.Cmp(expected) != 0) ||
(expected.Cmp(zero) != 0 && withdrawable.Cmp(zero) == 0) {
if expected.Cmp(zero) == 0 {
return fmt.Errorf("expected withdrawable stake to be %d, got: %d", expected, withdrawable)
} else {
return fmt.Errorf("expected withdrawable stake should not be equal to 0")
}
}

return nil
Expand Down

0 comments on commit a64053b

Please sign in to comment.