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).

Zcash: cherry-picked from commit 7650449a6777710cf818d41862626164da0cd412
Left over from 2aee461930
This commit is contained in:
Wladimir J. van der Laan 2015-07-18 07:44:19 +02:00 committed by Jack Grigg
parent a11c4bbd26
commit d101d7b8e6
No known key found for this signature in database
GPG Key ID: 6A6914DAFBEA00DA
1 changed files with 2 additions and 1 deletions

View File

@ -14,6 +14,7 @@ from struct import *
import binascii
import json
import StringIO
import decimal
try:
import http.client as httplib
@ -252,7 +253,7 @@ class RESTTest (BitcoinTestFramework):
response_header_json = http_get_call(url.hostname, url.port, '/rest/headers/1/'+bb_hash+self.FORMAT_SEPARATOR+"json", "", True)
assert_equal(response_header_json.status, 200)
response_header_json_str = response_header_json.read()
json_obj = json.loads(response_header_json_str)
json_obj = json.loads(response_header_json_str, parse_float=decimal.Decimal)
assert_equal(len(json_obj), 1) #ensure that there is one header in the json response
assert_equal(json_obj[0]['hash'], bb_hash) #request/response hash should be the same