diff options
| author | Wladimir J. van der Laan <[email protected]> | 2015-07-18 07:44:19 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-07-18 09:04:18 +0200 |
| commit | 7650449a6777710cf818d41862626164da0cd412 (patch) | |
| tree | ddb32fd03bd9df82961ea176810b50faba133a23 /src/rpcserver.cpp | |
| parent | rpc: Make ValueFromAmount always return 8 decimals (diff) | |
| download | discoin-7650449a6777710cf818d41862626164da0cd412.tar.xz discoin-7650449a6777710cf818d41862626164da0cd412.zip | |
univalue: Avoid unnecessary roundtrip through double for numbers
JSON makes no distinction between numbers and reals, and our code
doesn't need to do so either.
This removes VREAL, as well as its specific post-processing in
`UniValue::write`. Non-monetary amounts do not need to be forcibly
formatted with 8 decimals, so the extra roundtrip was unnecessary
(and potentially loses precision).
Diffstat (limited to 'src/rpcserver.cpp')
| -rw-r--r-- | src/rpcserver.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index c5402e0df..201fc5eba 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -120,7 +120,7 @@ void RPCTypeCheckObj(const UniValue& o, CAmount AmountFromValue(const UniValue& value) { - if (!value.isReal() && !value.isNum()) + if (!value.isNum()) throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number"); CAmount amount; if (!ParseFixedPoint(value.getValStr(), 8, &amount)) |