mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-29 05:12:39 +02:00
trying to fix payment check
This commit is contained in:
@@ -306,13 +306,26 @@ async def perform_lnurlauth(
|
|||||||
|
|
||||||
|
|
||||||
async def check_invoice_status(
|
async def check_invoice_status(
|
||||||
wallet_id: str, payment_hash: str, conn: Optional[Connection] = None
|
wallet_id: str,
|
||||||
|
payment_hash: str,
|
||||||
|
conn: Optional[Connection] = None,
|
||||||
) -> PaymentStatus:
|
) -> PaymentStatus:
|
||||||
payment = await get_wallet_payment(wallet_id, payment_hash, conn=conn)
|
payment = await get_wallet_payment(wallet_id, payment_hash, conn=conn)
|
||||||
if not payment:
|
if not payment:
|
||||||
return PaymentStatus(None)
|
return PaymentStatus(None)
|
||||||
|
status = await WALLET.get_invoice_status(payment.checking_id)
|
||||||
return await WALLET.get_invoice_status(payment.checking_id)
|
print(status)
|
||||||
|
if not payment.pending:
|
||||||
|
return status
|
||||||
|
if payment.is_out and status.failed:
|
||||||
|
print(f" - deleting outgoing failed payment {payment.checking_id}: {status}")
|
||||||
|
await payment.delete()
|
||||||
|
elif not status.pending:
|
||||||
|
print(
|
||||||
|
f" - marking '{'in' if payment.is_in else 'out'}' {payment.checking_id} as not pending anymore: {status}"
|
||||||
|
)
|
||||||
|
await payment.set_pending(status.pending)
|
||||||
|
return status
|
||||||
|
|
||||||
|
|
||||||
def fee_reserve(amount_msat: int) -> int:
|
def fee_reserve(amount_msat: int) -> int:
|
||||||
|
Reference in New Issue
Block a user