Browse Source

payment requests: fix explicit "None" expiration

Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\main_window.py", line 994, in <lambda>
    self.create_invoice_button.clicked.connect(lambda: self.create_invoice(False))
  File "...\electrum\electrum\gui\qt\main_window.py", line 1123, in create_invoice
    key = self.create_bitcoin_request(amount, message, expiry)
  File "...\electrum\electrum\gui\qt\main_window.py", line 1132, in create_bitcoin_request
    addr = self.wallet.get_unused_address()
  File "...\electrum\electrum\wallet.py", line 1452, in wrapper
    addr = func(self, *args, **kwargs)
  File "...\electrum\electrum\wallet.py", line 1465, in get_unused_address
    addrs = self.get_unused_addresses()
  File "...\electrum\electrum\wallet.py", line 1459, in get_unused_addresses
    in_use_by_request = [k for k in self.receive_requests.keys() if self.get_request_status(k)[0] != PR_EXPIRED]
  File "...\electrum\electrum\wallet.py", line 1459, in <listcomp>
    in_use_by_request = [k for k in self.receive_requests.keys() if self.get_request_status(k)[0] != PR_EXPIRED]
  File "...\electrum\electrum\wallet.py", line 1535, in get_request_status
    if exp > 0 and time.time() > timestamp + exp:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
hard-fail-on-bad-server-string
SomberNight 5 years ago
parent
commit
7b49832a3f
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 1
      electrum/gui/qt/request_list.py
  2. 2
      electrum/util.py
  3. 2
      electrum/wallet.py

1
electrum/gui/qt/request_list.py

@ -117,7 +117,6 @@ class RequestList(MyTreeView):
continue
request_type = req['type']
timestamp = req.get('time', 0)
expiration = req.get('exp', 0)
amount = req.get('amount')
message = req.get('message') or req.get('memo')
date = format_time(timestamp)

2
electrum/util.py

@ -113,7 +113,7 @@ pr_expiration_values = {
def get_request_status(req):
status = req['status']
exp = req.get('exp', 0)
exp = req.get('exp', 0) or 0
if req['status'] == PR_UNPAID and exp > 0 and req['time'] + req['exp'] < time.time():
status = PR_EXPIRED
status_str = pr_tooltips[status]

2
electrum/wallet.py

@ -1529,7 +1529,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
timestamp = r.get('time', 0)
if timestamp and type(timestamp) != int:
timestamp = 0
exp = r.get('exp', 0)
exp = r.get('exp', 0) or 0
paid, conf = self.get_payment_status(address, amount)
if not paid:
if exp > 0 and time.time() > timestamp + exp:

Loading…
Cancel
Save