electrum

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

commit f08796fe68955e7d2c6381b30a64873e74a3f464
parent daef1a8359cc16acd34c8faad7bd91a1061b5b6a
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 10 Dec 2019 14:45:29 +0100

Allow requests that never expire

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

diff --git a/electrum/gui/qt/request_list.py b/electrum/gui/qt/request_list.py @@ -117,7 +117,7 @@ class RequestList(MyTreeView): continue request_type = req['type'] timestamp = req.get('time', 0) - expiration = req.get('exp', None) + 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 @@ -104,6 +104,7 @@ pr_tooltips = { } pr_expiration_values = { + 0: _('Never'), 10*60: _('10 minutes'), 60*60: _('1 hour'), 24*60*60: _('1 day'), @@ -112,12 +113,13 @@ pr_expiration_values = { def get_request_status(req): status = req['status'] - if req['status'] == PR_UNPAID and 'exp' in req and req['time'] + req['exp'] < time.time(): + exp = req.get('exp', 0) + if req['status'] == PR_UNPAID and exp > 0 and req['time'] + req['exp'] < time.time(): status = PR_EXPIRED status_str = pr_tooltips[status] if status == PR_UNPAID: - if req.get('exp'): - expiration = req['exp'] + req['time'] + if exp > 0: + expiration = exp + req['time'] status_str = _('Expires') + ' ' + age(expiration, include_seconds=True) else: status_str = _('Pending') diff --git a/electrum/wallet.py b/electrum/wallet.py @@ -1527,12 +1527,10 @@ class Abstract_Wallet(AddressSynchronizer): timestamp = r.get('time', 0) if timestamp and type(timestamp) != int: timestamp = 0 - expiration = r.get('exp') - if expiration and type(expiration) != int: - expiration = 0 + exp = r.get('exp', 0) paid, conf = self.get_payment_status(address, amount) if not paid: - if expiration is not None and time.time() > timestamp + expiration: + if exp > 0 and time.time() > timestamp + exp: status = PR_EXPIRED else: status = PR_UNPAID