mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-03-03 17:37:06 +01:00
catch exception on invalid hash passed to sparko.
This commit is contained in:
parent
8e62d9287d
commit
e6ea77e682
1 changed files with 9 additions and 0 deletions
|
@ -108,6 +108,15 @@ class SparkWallet(Wallet):
|
||||||
return PaymentStatus(True)
|
return PaymentStatus(True)
|
||||||
|
|
||||||
def get_payment_status(self, checking_id: str) -> PaymentStatus:
|
def get_payment_status(self, checking_id: str) -> PaymentStatus:
|
||||||
|
# check if it's 32 bytes hex
|
||||||
|
if len(checking_id) != 64:
|
||||||
|
return PaymentStatus(None)
|
||||||
|
try:
|
||||||
|
int(checking_id, 16)
|
||||||
|
except ValueError:
|
||||||
|
return PaymentStatus(None)
|
||||||
|
|
||||||
|
# ask sparko
|
||||||
r = self.listpays(payment_hash=checking_id)
|
r = self.listpays(payment_hash=checking_id)
|
||||||
if not r["pays"]:
|
if not r["pays"]:
|
||||||
return PaymentStatus(False)
|
return PaymentStatus(False)
|
||||||
|
|
Loading…
Add table
Reference in a new issue