Confirm that only integer values for satoshis are sent to the node for broadcasting txs
Details
Details
- Reviewers
emack - Group Reviewers
Restricted Project - Commits
- rABC49db8e565759: [Cashtab] Integer validation for satoshi amounts
npm test
Diff Detail
Diff Detail
- Repository
- rABC Bitcoin ABC
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
cashtab/src/utils/cashMethods.js | ||
---|---|---|
562 ↗ | (On Diff #43699) | Can rounding cause error like insufficient balance ? shouldn't you use floor instead ? |
cashtab/src/utils/cashMethods.js | ||
---|---|---|
562 ↗ | (On Diff #43699) | What we really want is to get the value right. If the user has insufficient balance -- we want to know this and show this error. 151.52 * 100 = 15152.000000000002 but also, 4444.44 * 100 = 444443.99999999994 -->here, Math.floor will give us the wrong value (by 1 satoshi). At the very high end, we get weirder cases, like 20999999999999.01*100 = 2099999999999901.2 The nearest integer is always the right value though. An alt approach would be "pure string" manipulation. Will probably end up using this for eToken amounts (and perhaps then generalizing that approach to cover all tx building). |