From b4ad0e101d4a3ec139b099d573cd303c7460ca4b Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Fri, 20 May 2022 14:35:00 +0100 Subject: [PATCH] Revert "Check invoice status outgoing" --- lnbits/core/services.py | 5 +---- lnbits/core/views/api.py | 11 ++++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lnbits/core/services.py b/lnbits/core/services.py index 875f7644..3d54e218 100644 --- a/lnbits/core/services.py +++ b/lnbits/core/services.py @@ -321,10 +321,7 @@ async def check_invoice_status( payment = await get_wallet_payment(wallet_id, payment_hash, conn=conn) if not payment: return PaymentStatus(None) - if payment.is_out: - status = await WALLET.get_payment_status(payment.checking_id) - else: - status = await WALLET.get_invoice_status(payment.checking_id) + status = await WALLET.get_invoice_status(payment.checking_id) if not payment.pending: return status if payment.is_out and status.failed: diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index 85de97cd..3be3a460 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -365,13 +365,14 @@ 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)): - if X_Api_Key is not None: + wallet = None + try: + if X_Api_Key.extra: + print("No key") + except: wallet = await get_wallet_for_key(X_Api_Key) - else: - wallet = None payment = await get_standalone_payment(payment_hash) - if payment: - await check_invoice_status(payment.wallet_id, payment_hash) + await check_invoice_status(payment.wallet_id, payment_hash) payment = await get_standalone_payment(payment_hash) if not payment: raise HTTPException(