electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 7b49832a3f4f187e4718cc9d3e649c4453b7548f
parent 01fc0484841fc8ced7e96798d5f4ca794b37cd41
Author: SomberNight <somber.night@protonmail.com>
Date:   Mon, 16 Dec 2019 21:03:34 +0100

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'

Diffstat:
Melectrum/gui/qt/request_list.py | 1-
Melectrum/util.py | 2+-
Melectrum/wallet.py | 2+-
3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/electrum/gui/qt/request_list.py b/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) diff --git a/electrum/util.py b/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] diff --git a/electrum/wallet.py b/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: