electrum

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

commit 7c4d6c68018beb16a2ec8d5def26276e50582b5b
parent 5afdc14913c464643efe1bf65763e8285d5ac4b6
Author: SomberNight <somber.night@protonmail.com>
Date:   Sat, 13 Oct 2018 04:22:53 +0200

fix #4771

Diffstat:
Melectrum/tests/test_util.py | 5++++-
Melectrum/util.py | 2+-
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/electrum/tests/test_util.py b/electrum/tests/test_util.py @@ -13,9 +13,12 @@ class TestUtil(SequentialTestCase): def test_format_satoshis_negative(self): self.assertEqual("-0.00001234", format_satoshis(-1234)) - def test_format_fee(self): + def test_format_fee_float(self): self.assertEqual("1.7", format_fee_satoshis(1700/1000)) + def test_format_fee_decimal(self): + self.assertEqual("1.7", format_fee_satoshis(Decimal("1.7"))) + def test_format_fee_precision(self): self.assertEqual("1.666", format_fee_satoshis(1666/1000, precision=6)) diff --git a/electrum/util.py b/electrum/util.py @@ -514,7 +514,7 @@ def format_satoshis(x, num_zeros=0, decimal_point=8, precision=None, is_diff=Fal if precision is None: precision = decimal_point # format string - decimal_format = ".0" + str(precision) if precision > 0 else "" + decimal_format = "." + str(precision) if precision > 0 else "" if is_diff: decimal_format = '+' + decimal_format # initial result