tfix tests - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit dc1a31d80253df73dc5598cf1a255b31549da611 DIR parent f3f25348774255f1c3a3dc27822c48d761b1e87d HTML Author: SomberNight <somber.night@protonmail.com> Date: Sun, 7 Oct 2018 18:43:35 +0200 fix tests follow-up 70cca3bad9a40b5b5230e13c0d2fce7ae1312b53 Diffstat: M electrum/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- DIR diff --git a/electrum/util.py b/electrum/util.py t@@ -517,7 +517,9 @@ def format_satoshis(x, num_zeros=0, decimal_point=8, precision=None, is_diff=Fal decimal_format = '+' + decimal_format # initial result scale_factor = pow(10, decimal_point) - result = ("{:" + decimal_format + "f}").format(Decimal(x) / scale_factor) + if not isinstance(x, Decimal): + x = Decimal(x).quantize(Decimal('1E-8')) + result = ("{:" + decimal_format + "f}").format(x / scale_factor) if "." not in result: result += "." result = result.rstrip('0') # extra decimal places