You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: recover stalled wallet syncs via refresh timeout and progress reorder
Two targeted changes to _refresh() in the base Wallet<T> class, which
affects all wallet types that route through the shared refresh flow
(BTC, LTC, Firo, Monero, ETH, Cardano, Solana, etc. — but NOT
MimbleWimbleCoin, ETH tokens, or SOL tokens, which override refresh()).
1. 60-minute master timeout on the refresh body. If any sub-operation
hangs indefinitely (network death, OS-suspended sockets, wedged
native-lib callbacks), TimeoutException now unwinds through the
existing catch/finally and releases refreshMutex. Previously the
mutex would remain locked forever, making every subsequent periodic
sync bail out at the isLocked check until the app was force-closed.
The timeout is intentionally generous. Per-call timeouts are handled
by underlying adapters (e.g. electrum adapter's connectionTimeout /
aliveTimerDuration at 60s each). The master timeout only needs to
catch what slips through those layers. 60 minutes covers worst-case
legitimate initial syncs (Monero restore, full Spark anonymity set
download on a slow connection) while still recovering from true
hangs within an hour.
Note: .timeout() does not cancel in-flight work; it only completes
the outer future. The intent is to recover the mutex.
2. Fire progress updates *after* the awaited work completes rather
than before. The 0.65 and 0.70 calls previously fired immediately
after kicking off updateUTXOs/updateTransactions, making the bar
appear stuck at those values while the real work was still running.
The ~65% stall in Firo syncs was the most visible manifestation of
this; other wallets had the same cosmetic issue.
The refresh body is also extracted to a private _doRefreshWork(viewOnly)
helper to keep _refresh() focused on mutex/event/timeout/error handling.
No behavioral change from the extraction.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments