-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Summary
The _startInvoicePaymentMonitoring method in lib/screens/9receive_screen.dart uses a Timer.periodic callback that fires every 2 seconds without waiting for the previous checkInvoiceStatus HTTP call to complete. Since checkInvoiceStatus can have timeouts of 20–30 seconds, multiple callbacks can overlap and create concurrent redundant requests.
Proposed Fix
Add a private boolean field _isCheckingInvoiceStatus as a reentrancy guard:
bool _isCheckingInvoiceStatus = false;
// Inside the Timer.periodic callback:
if (_isCheckingInvoiceStatus) return;
_isCheckingInvoiceStatus = true;
try {
// ... checkInvoiceStatus call ...
} catch (e) {
// ... error handling ...
} finally {
_isCheckingInvoiceStatus = false;
}Also ensure _invoicePaymentTimeoutTimer is cancelled and nulled when the invoice is confirmed paid inside the periodic callback.
Context
- This issue is pre-existing in the codebase and was not introduced by PR feat: Allow receiving payments without Lightning Address #55.
- Identified during review of PR feat: Allow receiving payments without Lightning Address #55: feat: Allow receiving payments without Lightning Address #55
- Related review comment: feat: Allow receiving payments without Lightning Address #55 (comment)
- Requested by: @Delgado74
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels