test: re-enable CLI test support by using EncodeDecimal in json.dumps()

As mentioned in
https://github.com/bitcoin/bitcoin/pull/17675#issuecomment-563188648
This commit is contained in:
fanquake
2019-12-09 15:02:50 -05:00
parent 347dd76ec8
commit b6f9e3576a
14 changed files with 7 additions and 13 deletions

View File

@@ -190,6 +190,11 @@ def check_json_precision():
if satoshis != 2000000000000003:
raise RuntimeError("JSON encode/decode loses precision")
def EncodeDecimal(o):
if isinstance(o, Decimal):
return str(o)
raise TypeError(repr(o) + " is not JSON serializable")
def count_bytes(hex_string):
return len(bytearray.fromhex(hex_string))