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:
parent
0b98dd7939
commit
d7b80b54fb
1 changed files with 1 additions and 1 deletions
|
@ -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):
|
||||||
|
|
Loading…
Reference in a new issue