diff options
| author | Wladimir J. van der Laan <[email protected]> | 2017-08-08 11:27:15 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2017-08-08 11:27:29 +0200 |
| commit | 627c3c0e495b30af39a8cd8b3336770a6031097b (patch) | |
| tree | 72eec7e72e54f6ca15eb1a36c43a7f5cda2469b0 /doc | |
| parent | Merge #11001: [tests] Test disconnecting unsupported service bits logic. (diff) | |
| parent | doc: Add comment to use ValueFromAmount/AmountFromValue for JSON, not utilmon... (diff) | |
| download | discoin-627c3c0e495b30af39a8cd8b3336770a6031097b.tar.xz discoin-627c3c0e495b30af39a8cd8b3336770a6031097b.zip | |
Merge #10999: Fix amounts formatting in `decoderawtransaction`
ce07638 doc: Add comment to use ValueFromAmount/AmountFromValue for JSON, not utilmoneystr (Wladimir J. van der Laan)
ec05c50 rpc: Use ValueFromAmount instead of FormatMoney in TxToUniv (Wladimir J. van der Laan)
46347ad rpc: Move ValueFromAmount to core_write (Wladimir J. van der Laan)
dac3782 doc: Correct AmountFromValue/ValueFromAmount names (Wladimir J. van der Laan)
Pull request description:
With this, the amounts returned in `decoderawtransaction` will be padded to 8 digits like anywhere else in the API.
This is accomplished by using `ValueFromAmount` in `TxToUniv`, instead of `FormatMoney` which it currently (mistakingly) uses. The `FormatMoney` function is only for debugging/logging use!
To avoid dependency issues, `ValueFromAmount` is moved to `core_write.cpp`, where it also fits better. I don't move `AmountFromValue` to `core_read.cpp` at the same time, as this would have more impact due to the RPCError dependency there.
(n.b.: large number of changed files is solely due to the util_tests JSONs needing update)
Tree-SHA512: 10fc2d27d33a77dbcb57aa7eccd4f53110c05d38eb7df6d40f10f14c08fad4274472e93af75aa59fe68ad0720fdf0930f0108124abef518e0dd162b3d2b2b292
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/developer-notes.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 458e7bcbf..d783a7a8a 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -561,10 +561,10 @@ A few guidelines for introducing and reviewing new RPC interfaces: which is error prone, and it is easy to get things such as escaping wrong. JSON already supports nested data structures, no need to re-invent the wheel. - - *Exception*: AmountToValue can parse amounts as string. This was introduced because many JSON + - *Exception*: AmountFromValue can parse amounts as string. This was introduced because many JSON parsers and formatters hard-code handling decimal numbers as floating point values, resulting in potential loss of precision. This is unacceptable for - monetary values. **Always** use `AmountToValue` and `ValueToAmount` when + monetary values. **Always** use `AmountFromValue` and `ValueFromAmount` when inputting or outputting monetary values. The only exceptions to this are `prioritisetransaction` and `getblocktemplate` because their interface is specified as-is in BIP22. |