Use it in various places instead of the GetSatoshi method.
Details
- Reviewers
jasonbcox - Group Reviewers
Restricted Project - Commits
- rSTAGING8b468bf3073e: Add a SATOSHI constant representing an Amount of one satoshi.
rABC8b468bf3073e: Add a SATOSHI constant representing an Amount of one satoshi.
./test/functional/test_runner.py --extended
Diff Detail
- Repository
- rABC Bitcoin ABC
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
I don't understand the purpose of this diff. Can you clarify why you think replacing GetSatoshis() with a division makes sense? It appears more difficult to read to me (and maybe even more error prone?)
src/amount.h | ||
---|---|---|
31 ↗ | (On Diff #4098) | Does this comment still make sense? The return value is always satoshis, so I'm not sure what these non-monetary operations are. |
32 ↗ | (On Diff #4098) | Why not use / SATOSHI here? |
144 ↗ | (On Diff #4098) | :[ |
145 ↗ | (On Diff #4098) | I would prefer BITCOIN, personally. Doesn't *really* matter though. |
src/amount.h | ||
---|---|---|
32 ↗ | (On Diff #4098) | Ah yes. |
Clarified why this change is necessary on Slack:
deadalnix [8:16 AM]
Using a division makes it clear that precision may be lost. Changing getsatoshi is a reciepe for disaster as one callsite missed will cause code to do weird stuff.
jasonbcox [8:21 AM]
I guess that's a fair point. division at each site also allows migrations to be done one step at a time