mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 09:21:39 +00:00
do not display 'Expires in 100 years' for LN invoices
This commit is contained in:
parent
8cb36cb969
commit
0878fe08f7
2 changed files with 9 additions and 7 deletions
|
@ -56,6 +56,12 @@ assert PR_DEFAULT_EXPIRATION_WHEN_CREATING in pr_expiration_values
|
|||
|
||||
outputs_decoder = lambda _list: [PartialTxOutput.from_legacy_tuple(*x) for x in _list]
|
||||
|
||||
# hack: BOLT-11 is not really clear on what an expiry of 0 means.
|
||||
# It probably interprets it as 0 seconds, so already expired...
|
||||
# Our higher level invoices code however uses 0 for "never".
|
||||
# Hence set some high expiration here
|
||||
LN_EXPIRY_NEVER = 100 * 365 * 24 * 60 * 60 # 100 years
|
||||
|
||||
@attr.s
|
||||
class Invoice(StoredObject):
|
||||
type = attr.ib(type=int)
|
||||
|
@ -70,7 +76,7 @@ class Invoice(StoredObject):
|
|||
def get_status_str(self, status):
|
||||
status_str = pr_tooltips[status]
|
||||
if status == PR_UNPAID:
|
||||
if self.exp > 0:
|
||||
if self.exp > 0 and self.exp != LN_EXPIRY_NEVER:
|
||||
expiration = self.exp + self.time
|
||||
status_str = _('Expires') + ' ' + age(expiration, include_seconds=True)
|
||||
else:
|
||||
|
|
|
@ -24,7 +24,7 @@ from aiorpcx import run_in_thread
|
|||
from . import constants, util
|
||||
from . import keystore
|
||||
from .util import profiler
|
||||
from .invoices import PR_TYPE_LN, PR_UNPAID, PR_EXPIRED, PR_PAID, PR_INFLIGHT, PR_FAILED, PR_ROUTING, LNInvoice
|
||||
from .invoices import PR_TYPE_LN, PR_UNPAID, PR_EXPIRED, PR_PAID, PR_INFLIGHT, PR_FAILED, PR_ROUTING, LNInvoice, LN_EXPIRY_NEVER
|
||||
from .util import NetworkRetryManager
|
||||
from .lnutil import LN_MAX_FUNDING_SAT
|
||||
from .keystore import BIP32_KeyStore
|
||||
|
@ -1086,11 +1086,7 @@ class LNWallet(LNWorker):
|
|||
info = PaymentInfo(payment_hash, amount_sat, RECEIVED, PR_UNPAID)
|
||||
amount_btc = amount_sat/Decimal(COIN) if amount_sat else None
|
||||
if expiry == 0:
|
||||
# hack: BOLT-11 is not really clear on what an expiry of 0 means.
|
||||
# It probably interprets it as 0 seconds, so already expired...
|
||||
# Our higher level invoices code however uses 0 for "never".
|
||||
# Hence set some high expiration here
|
||||
expiry = 100 * 365 * 24 * 60 * 60 # 100 years
|
||||
expiry = LN_EXPIRY_NEVER
|
||||
lnaddr = LnAddr(paymenthash=payment_hash,
|
||||
amount=amount_btc,
|
||||
tags=[('d', message),
|
||||
|
|
Loading…
Add table
Reference in a new issue