1
0

qt send tab: handle invalid ln invoice; and ln invoice with ln disabled

fixes #5639
fixes #5662
This commit is contained in:
SomberNight
2019-10-01 19:07:27 +02:00
parent 1773bd6cd6
commit 8dabdf8bfb
3 changed files with 72 additions and 35 deletions

View File

@@ -276,10 +276,14 @@ class LnAddr(object):
now = time.time()
return now > self.get_expiry() + self.date
def lndecode(a, verbose=False, expected_hrp=None):
class LnDecodeException(Exception): pass
def lndecode(invoice: str, *, verbose=False, expected_hrp=None) -> LnAddr:
if expected_hrp is None:
expected_hrp = constants.net.SEGWIT_HRP
hrp, data = bech32_decode(a, ignore_long_length=True)
hrp, data = bech32_decode(invoice, ignore_long_length=True)
if not hrp:
raise ValueError("Bad bech32 checksum")