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

3749: Do not attempt to send a message if the sender balance is 0. #4750

Closed
wants to merge 1 commit into from

Conversation

jennijuju
Copy link
Member

@jennijuju jennijuju commented Nov 6, 2020

@arajasek this is to address your suggestion for #3749, please feel free to close both pr & issue if you no longer think it's necessary!

@jennijuju jennijuju requested a review from arajasek November 6, 2020 07:24
@jennijuju jennijuju changed the title 3479: Do not attempt to send a message if the sender balance is 0. 3749: Do not attempt to send a message if the sender balance is 0. Nov 6, 2020
@jennijuju jennijuju force-pushed the 3749-zero-balance-account branch from 8601790 to be6249f Compare November 6, 2020 07:25
@jennijuju jennijuju linked an issue Nov 6, 2020 that may be closed by this pull request
@@ -631,6 +632,10 @@ func (mp *MessagePool) checkBalance(m *types.SignedMessage, curTs *types.TipSet)
return xerrors.Errorf("failed to check sender balance: %s: %w", err, ErrSoftValidationFailure)
}

if balance == abi.NewTokenAmount(0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this isn't the right check. It will return true if the fields of the two abi.TokenAmount structs (balance and abi.NewTokenAmount(0)) are the same, which will be false. Use the IsZero() method instead.

For more: https://medium.com/learning-the-go-programming-language/comparing-values-in-go-8f7b002e767a.

@arajasek
Copy link
Contributor

arajasek commented Nov 9, 2020

Thanks for this, but I don't think it's needed, see note in #3749.

@arajasek arajasek closed this Nov 9, 2020
@jennijuju jennijuju deleted the 3749-zero-balance-account branch May 13, 2021 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not try to send messages from addresses with 0 balance.
2 participants