fix: Infinite invoice listener loop with VoidWallet (#4061)
What changed, and why it matters
This commit removes a method from LNbits' VoidWallet (a fake/test wallet) that was causing an infinite loop when listening for paid invoices. The removed method repeatedly yielded empty invoice IDs, which could make background invoice-listener tasks spin forever. This is a reliability/bug-fix change rather than a direct security vulnerability, but infinite loops in background services can waste resources and potentially affect availability.
Review how the invoice listener handles wallets that do not implement or return from `paid_invoices_stream`; ensure the listener has robust termination/exception handling. Apply this patch to avoid infinite loops when VoidWallet is configured.
Security signals we found
Infinite loop in background service
Resource exhaustion / denial-of-service potential
Removal of non-functional invoice stream implementation
Evidence from the diff
The patch deletes paid_invoices_stream from lnbits/wallets/void.py. The method was an async generator that yielded an empty string forever (yield ""), which likely caused the invoice listener to loop indefinitely when VoidWallet was active. The import of AsyncGenerator is also removed as it is no longer used. The fix prevents the listener from running a tight infinite loop, improving CPU/resource usage and service stability in test/void-wallet configurations.
Changed components
lnbits/wallets/void.pyVoidWallet.paid_invoices_streamInspect captured patch +0 / −5
diff --git a/lnbits/wallets/void.py b/lnbits/wallets/void.py
index 6d2ac9f..ca38dc2 100644
--- a/lnbits/wallets/void.py
+++ b/lnbits/wallets/void.py
@@ -1,5 +1,3 @@
-from collections.abc import AsyncGenerator
-
from loguru import logger
from .base import (
@@ -40,6 +38,3 @@ class VoidWallet(Wallet):
async def get_payment_status(self, *_, **__) -> PaymentStatus:
return PaymentPendingStatus()
-
- async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
- yield ""
Why this scored 24/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.