From 1e0aa9329d18c356cd82e307116bb03c9345ced5 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Wed, 8 May 2019 01:34:18 +0200 Subject: [PATCH] fix: pylightning to_btc_str precision The old codes if % 1000 statement logic was simply inverted and produced the opposite output of the intention behin it. Before Fix: - Millisatoshi('42sat').to_btc_str() => 0.00000042000btc - Millisatoshi('42001msat').to_btc_str() => 0.00000042btc After Fix: - Millisatoshi('42sat').to_btc_str() => 0.00000042btc - Millisatoshi('42001msat').to_btc_str() => 0.00000042001btc --- contrib/pylightning/lightning/lightning.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/pylightning/lightning/lightning.py b/contrib/pylightning/lightning/lightning.py index a79a6ee95..ad65fffce 100644 --- a/contrib/pylightning/lightning/lightning.py +++ b/contrib/pylightning/lightning/lightning.py @@ -81,9 +81,9 @@ class Millisatoshi: Return a string of form 12.34567890btc or 12.34567890123btc. """ if self.millisatoshis % 1000: - return '{:.8f}btc'.format(self.to_btc()) - else: return '{:.11f}btc'.format(self.to_btc()) + else: + return '{:.8f}btc'.format(self.to_btc()) def to_json(self): return self.__repr__()