Polling Bug#502
Conversation
- Only poll for active account
…into beast/polling-bug
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0b4ee4a. Configure here.
| try { | ||
| // Check if we have accounts available | ||
| final accountsState = _ref.read(accountsProvider); | ||
| if (accountsState.value?.isEmpty ?? true) { |
There was a problem hiding this comment.
Double timer scheduling causes orphaned polling timers
Medium Severity
When activeAccountId returns null, _scheduleNextPoll() is called inside the try block followed by return. Since the finally block always executes on return, _scheduleNextPoll() runs again, overwriting _pollingTimer and orphaning the first timer. The orphaned timer still fires, effectively doubling poll frequency. The new condition (activeId == null) is more easily triggered during normal operation (e.g., account switching or loading states) compared to the old condition (accounts empty), which was well-guarded by the listener that stops polling when accounts are empty.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 0b4ee4a. Configure here.


Summary
Fixed the bug of polling visited accounts even though not active.
Note
Medium Risk
Changes how pending transactions reconcile and how balances/history refresh on timers and account switches; incorrect scoping could leave stale UI or miss reconciliation for inactive accounts.
Overview
Background polling and history refresh no longer fan out across every wallet account or the global
paginationControllerProvider. A newpolling_refresh_scopehelper centralizes active-account-only silent refresh, targeted balance invalidation, and account-switch refresh.Global history polling now refreshes only the active account’s pagination (and only when that provider is already alive), awaits reconciliation, and triggers
refreshActiveAccountOnSwitchwhen the selected account changes.Pending tx silent refresh and reconciliation scope to affected parties plus the active account; reconciliation reads confirmed history from per-account filtered pagination instead of
allTransactionsProvider, and refreshes non-active accounts only when their pagination cache exists.Reversible transfer monitoring listens to the active account’s pagination stream instead of wallet-wide history, drops global pagination updates on execution, and limits balance invalidation to sender/receiver.
updatePaginationFiltersForcan restrict which transaction filters are updated.Unit tests cover refresh-target and reconciliation account ID scoping.
Reviewed by Cursor Bugbot for commit 0b4ee4a. Bugbot is set up for automated code reviews on this repo. Configure here.