fix opening wallet that has "max" amount invoice saved
E | gui.qt.ElectrumGui |
Traceback (most recent call last):
File "...\electrum\electrum\gui\qt\__init__.py", line 361, in start_new_window
window = self._create_window_for_wallet(wallet)
File "...\electrum\electrum\gui\qt\__init__.py", line 304, in _create_window_for_wallet
w = ElectrumWindow(self, wallet)
File "...\electrum\electrum\gui\qt\main_window.py", line 223, in __init__
self.send_tab = self.create_send_tab()
File "...\electrum\electrum\gui\qt\main_window.py", line 1537, in create_send_tab
self.invoice_list = InvoiceList(self)
File "...\electrum\electrum\gui\qt\invoice_list.py", line 76, in __init__
self.update()
File "...\electrum\electrum\gui\qt\invoice_list.py", line 109, in update
amount = item.get_amount_sat()
File "...\electrum\electrum\invoices.py", line 158, in get_amount_sat
return int(amount_msat / 1000)
TypeError: unsupported operand type(s) for /: 'str' and 'int'
This commit is contained in:
@@ -138,7 +138,7 @@ class Invoice(StoredObject):
|
||||
# 0 means never
|
||||
return self.exp + self.time if self.exp else 0
|
||||
|
||||
def get_amount_msat(self):
|
||||
def get_amount_msat(self) -> Union[int, str, None]:
|
||||
return self.amount_msat
|
||||
|
||||
def get_time(self):
|
||||
@@ -147,15 +147,15 @@ class Invoice(StoredObject):
|
||||
def get_message(self):
|
||||
return self.message
|
||||
|
||||
def get_amount_sat(self) -> Union[int, str]:
|
||||
def get_amount_sat(self) -> Union[int, str, None]:
|
||||
"""
|
||||
Returns an integer satoshi amount, or '!' or None.
|
||||
Callers who need msat precision should call get_amount_msat()
|
||||
"""
|
||||
amount_msat = self.amount_msat
|
||||
if amount_msat is None:
|
||||
return None
|
||||
return int(amount_msat / 1000)
|
||||
if amount_msat in [None, "!"]:
|
||||
return amount_msat
|
||||
return int(amount_msat // 1000)
|
||||
|
||||
def get_bip21_URI(self, lightning=None):
|
||||
from electrum.util import create_bip21_uri
|
||||
|
||||
Reference in New Issue
Block a user