fix format_satoshis
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
ELECTRUM_VERSION = "0.51"
|
ELECTRUM_VERSION = "0.52"
|
||||||
SEED_VERSION = 4 # bump this everytime the seed generation is modified
|
SEED_VERSION = 4 # bump this everytime the seed generation is modified
|
||||||
|
|||||||
@@ -213,10 +213,18 @@ def raw_tx( inputs, outputs, for_sig = None ):
|
|||||||
|
|
||||||
def format_satoshis(x, is_diff=False, num_zeros = 0):
|
def format_satoshis(x, is_diff=False, num_zeros = 0):
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
s = str( Decimal(x) /100000000 )
|
s = Decimal(x)
|
||||||
if is_diff and x>0:
|
sign, digits, exp = s.as_tuple()
|
||||||
|
digits = map(str, digits)
|
||||||
|
while len(digits) < 9:
|
||||||
|
digits.insert(0,'0')
|
||||||
|
digits.insert(-8,'.')
|
||||||
|
s = ''.join(digits).rstrip('0')
|
||||||
|
if sign:
|
||||||
|
s = '-' + s
|
||||||
|
elif is_diff:
|
||||||
s = "+" + s
|
s = "+" + s
|
||||||
if not '.' in s: s += '.'
|
|
||||||
p = s.find('.')
|
p = s.find('.')
|
||||||
s += "0"*( 1 + num_zeros - ( len(s) - p ))
|
s += "0"*( 1 + num_zeros - ( len(s) - p ))
|
||||||
s += " "*( 9 - ( len(s) - p ))
|
s += " "*( 9 - ( len(s) - p ))
|
||||||
|
|||||||
Reference in New Issue
Block a user