Browse Source

fix: spark create_invoice error case.

aiosqlite
fiatjaf 5 years ago
parent
commit
1e4f39954e
  1. 6
      lnbits/wallets/spark.py

6
lnbits/wallets/spark.py

@ -40,7 +40,7 @@ class SparkWallet(Wallet):
def create_invoice(self, amount: int, memo: str = "", description_hash: bytes = b"") -> InvoiceResponse: def create_invoice(self, amount: int, memo: str = "", description_hash: bytes = b"") -> InvoiceResponse:
label = "lbs{}".format(random.random()) label = "lbs{}".format(random.random())
print(description_hash, len(description_hash)) checking_id = label
try: try:
if description_hash: if description_hash:
@ -49,9 +49,9 @@ class SparkWallet(Wallet):
) )
else: else:
r = self.invoice(msatoshi=amount * 1000, label=label, description=memo, exposeprivatechannels=True) r = self.invoice(msatoshi=amount * 1000, label=label, description=memo, exposeprivatechannels=True)
ok, checking_id, payment_request, error_message = True, label, r["bolt11"], None ok, payment_request, error_message = True, r["bolt11"], ""
except (SparkError, UnknownError) as e: except (SparkError, UnknownError) as e:
ok, checking_id, payment_request, error_message = False, None, None, str(e) ok, payment_request, error_message = False, None, str(e)
return InvoiceResponse(ok, checking_id, payment_request, error_message) return InvoiceResponse(ok, checking_id, payment_request, error_message)

Loading…
Cancel
Save