HomePhabricator

Merge #10999: Fix amounts formatting in `decoderawtransaction`

Description

Merge #10999: Fix amounts formatting in decoderawtransaction

Summary:
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

Backport of Core PR10999
https://github.com/bitcoin/bitcoin/pull/10999

Test Plan:

make check
test_runner.py

Reviewers: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3344

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Aug 8 2017, 09:27
nakihitoCommitted on Jun 19 2019, 19:22
nakihitoPushed on Jun 19 2019, 19:23
Reviewer
Restricted Owners Package
Differential Revision
D3344: Merge #10999: Fix amounts formatting in `decoderawtransaction`
Parents
rABC04dacad3085c: [refactor] Make TransactionWithinChainLimit more flexible
Branches
Unknown
Tags
Unknown