mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-10 04:22:35 +02:00
catch exception on invalid hash passed to sparko.
This commit is contained in:
@@ -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)
|
||||||
|
Reference in New Issue
Block a user