fix format_satoshis for None values
This commit is contained in:
parent
51b62c2983
commit
bbaacef960
|
@ -109,6 +109,8 @@ def user_dir():
|
||||||
|
|
||||||
def format_satoshis(x, is_diff=False, num_zeros = 0, decimal_point = 8, whitespaces=False):
|
def format_satoshis(x, is_diff=False, num_zeros = 0, decimal_point = 8, whitespaces=False):
|
||||||
from locale import localeconv
|
from locale import localeconv
|
||||||
|
if x is None:
|
||||||
|
return 'unknown'
|
||||||
x = int(x) # Some callers pass Decimal
|
x = int(x) # Some callers pass Decimal
|
||||||
scale_factor = pow (10, decimal_point)
|
scale_factor = pow (10, decimal_point)
|
||||||
integer_part = "{:n}".format(int(abs(x) / float(scale_factor)))
|
integer_part = "{:n}".format(int(abs(x) / float(scale_factor)))
|
||||||
|
|
Loading…
Reference in New Issue