aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/rest.py
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-07-18 07:44:19 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-07-18 09:04:18 +0200
commit7650449a6777710cf818d41862626164da0cd412 (patch)
treeddb32fd03bd9df82961ea176810b50faba133a23 /qa/rpc-tests/rest.py
parente061e2778d592826970483e0844308c4e9a12626 (diff)
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 'qa/rpc-tests/rest.py')
-rwxr-xr-xqa/rpc-tests/rest.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/qa/rpc-tests/rest.py b/qa/rpc-tests/rest.py
index 1a2d326cc3..b0cde7268e 100755
--- a/qa/rpc-tests/rest.py
+++ b/qa/rpc-tests/rest.py
@@ -14,6 +14,7 @@ from struct import *
import binascii
import json
import StringIO
+import decimal
try:
import http.client as httplib
@@ -243,7 +244,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