mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-09 09:04:25 +01:00
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
This commit is contained in:
committed by
neil saitug
parent
fefe7dfbab
commit
1e0aa9329d
@@ -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__()
|
||||
|
||||
Reference in New Issue
Block a user