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

did not check whether the amount is real #169

Open
ClareLau61803 opened this issue Mar 4, 2019 · 3 comments
Open

did not check whether the amount is real #169

ClareLau61803 opened this issue Mar 4, 2019 · 3 comments

Comments

@ClareLau61803
Copy link

ClareLau61803 commented Mar 4, 2019

wallet.js -sendMultiPayment(): did not check whether the amount is real. The decimal part will be lost when the data is stored into database. Verification failed when other nodes(like headless) synchronize unit and verify.

@ClareLau61803
Copy link
Author

issue code:
if (amount){
if (typeof amount !== 'number')
throw Error('amount must be a number');
if (amount < 0)
throw Error('amount must be positive');
}

@Papabyte
Copy link
Contributor

Papabyte commented Mar 5, 2019

Such a try should result on a validation error at this point of code:
https://github.com/byteball/ocore/blob/master/composer.js#L651
with something like Validation error: amount must be positive integer, found 996741.7 returned as error.
It's before broadcasting or writing into database so I don't understand the consequences you are talking about.
It should be appropriate though to add a check for integer directly in sendMultiPayment function.

@tarmo888
Copy link
Member

tarmo888 commented Mar 8, 2020

All amounts are integer, in the smallest unit (bytes). There is no decimals.

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

No branches or pull requests

3 participants