From dc1a31d80253df73dc5598cf1a255b31549da611 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sun, 7 Oct 2018 18:43:35 +0200 Subject: [PATCH] fix tests follow-up 70cca3bad9a40b5b5230e13c0d2fce7ae1312b53 --- electrum/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/electrum/util.py b/electrum/util.py index 8b796d050..759fb740e 100644 --- a/electrum/util.py +++ b/electrum/util.py @@ -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