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

Add IsValid function to Coin #4556

Closed
4 tasks
colin-axner opened this issue Jun 14, 2019 · 0 comments · Fixed by #4558
Closed
4 tasks

Add IsValid function to Coin #4556

colin-axner opened this issue Jun 14, 2019 · 0 comments · Fixed by #4558

Comments

@colin-axner
Copy link
Contributor

Summary

denomination validation is not done for Coin unless you use its constructor

Problem Definition

validateDenom is only called on Coin when using NewCoin or ParseCoin. A module that uses only Coin and not Coins can't appropriately validate the denomination without redundant code. A user could create a Coin without the constructor to bypass validation.

Proposal

Add an IsValid function to Coin that calls validateDenom as well as checking that the coin is > 0.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
alessio pushed a commit that referenced this issue Jun 18, 2019
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 a pull request may close this issue.

1 participant