Merge pull request #619 from lnbits/check_invoice_status_outgoing

Check invoice status outgoing
This commit is contained in:
Arc 2022-05-17 14:17:41 +01:00 committed by GitHub
commit 2337471e45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -321,7 +321,10 @@ async def check_invoice_status(
payment = await get_wallet_payment(wallet_id, payment_hash, conn=conn)
if not payment:
return PaymentStatus(None)
status = await WALLET.get_invoice_status(payment.checking_id)
if payment.is_out:
status = await WALLET.get_payment_status(payment.checking_id)
else:
status = await WALLET.get_invoice_status(payment.checking_id)
if not payment.pending:
return status
if payment.is_out and status.failed:

View file

@ -365,14 +365,13 @@ async def api_payments_sse(
@core_app.get("/api/v1/payments/{payment_hash}")
async def api_payment(payment_hash, X_Api_Key: Optional[str] = Header(None)):
wallet = None
try:
if X_Api_Key.extra:
print("No key")
except:
if X_Api_Key is not None:
wallet = await get_wallet_for_key(X_Api_Key)
else:
wallet = None
payment = await get_standalone_payment(payment_hash)
await check_invoice_status(payment.wallet_id, payment_hash)
if payment:
await check_invoice_status(payment.wallet_id, payment_hash)
payment = await get_standalone_payment(payment_hash)
if not payment:
raise HTTPException(