test_framework: Avoid infinite loop in encoding Decimal

Avoid an infinite loop in encoding, by ensuring EncodeDecimal
returns a string. round(Decimal) used to convert it to
float, but it no longer does in python 3.x. Strings are
supported since #6380, so just use that.
This commit is contained in:
Wladimir J. van der Laan 2016-03-28 11:44:19 +02:00
parent 0b98dd7939
commit d7b80b54fb

View file

@ -61,7 +61,7 @@ class JSONRPCException(Exception):
def EncodeDecimal(o): def EncodeDecimal(o):
if isinstance(o, decimal.Decimal): if isinstance(o, decimal.Decimal):
return round(o, 8) return str(o)
raise TypeError(repr(o) + " is not JSON serializable") raise TypeError(repr(o) + " is not JSON serializable")
class AuthServiceProxy(object): class AuthServiceProxy(object):