electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit dc1a31d80253df73dc5598cf1a255b31549da611
parent f3f25348774255f1c3a3dc27822c48d761b1e87d
Author: SomberNight <somber.night@protonmail.com>
Date:   Sun,  7 Oct 2018 18:43:35 +0200

fix tests

follow-up 70cca3bad9a40b5b5230e13c0d2fce7ae1312b53

Diffstat:
Melectrum/util.py | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 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