From b744af1de528335cfab21a772f30324791f7261b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Mon, 2 Feb 2026 13:58:07 +0100 Subject: [PATCH] fix: websocket with old balance was sent --- lnbits/core/services/payments.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lnbits/core/services/payments.py b/lnbits/core/services/payments.py index 454a5e54a..488a44529 100644 --- a/lnbits/core/services/payments.py +++ b/lnbits/core/services/payments.py @@ -776,7 +776,12 @@ async def _pay_internal_invoice( await update_payment(internal_payment, conn=conn) logger.success(f"internal payment successful {internal_payment.checking_id}") - send_payment_notification_in_background(wallet, payment) + # fetch balance again + _wallet = await get_wallet(wallet.id, conn=conn) + if not _wallet: + raise PaymentError(f"Could not fetch wallet '{wallet.id}'.", status="failed") + + send_payment_notification_in_background(_wallet, payment) # notify receiver asynchronously from lnbits.tasks import internal_invoice_queue @@ -849,7 +854,16 @@ async def _pay_external_invoice( payment = await update_payment_success_status( payment, payment_response, conn=conn ) - send_payment_notification_in_background(wallet, payment) + + # fetch wallet balance + _wallet = await get_wallet(wallet.id, conn=conn) + if not _wallet: + raise PaymentError( + f"Could not fetch wallet '{wallet.id}'.", + status="failed", + ) + + send_payment_notification_in_background(_wallet, payment) logger.success(f"payment successful {payment_response.checking_id}") payment.checking_id = payment_response.checking_id