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
{{ message }}
Repository navigation
fix: back off a Pubky Swaps claim whose advance keeps failing #2173
A Pubky Swaps route whose advance keeps failing is retried every 30 s, with no backoff and no limit, for as long as the app is open. It starts again on every launch.
PubkySwapsRouteRepo.pollClaim (:425-451) treats every advance error except PubkySwapException.NotFound as transient. It logs Failed to advance Pubky Swaps route and sleeps a flat CONFIRMATION_POLL_INTERVAL (30 s, :81). The background loop (:394, untilConfirmed = true) has no timeout.
bitkit-core's advance_blocking (rc15 client.rs:644-649) connects to the Electrum URL frozen in the swap record and reads the tip and history before claim::next_step. If that server stays unreachable, advance throws on every call, so the swap never reaches Failed and is never untracked.
Example: a swap is committed, then the user changes Electrum server, or the old server goes away. The app then makes one failing Electrum connection and logs a warning every 30 s per such swap, on every launch, until a wipe.
Fix
Count consecutive advance failures, reset the count on any returned state, and back off only the background loop, for example interval * 2^min(n, 6), capped at 32 min at 30 s. That keeps a recovered server reachable. The foreground 2 s claim wait keeps its fixed interval.
The iOS port (synonymdev/bitkit-ios#1386) has the same behaviour. It was raised there as a LOW, with a verified fix and a failing PubkySwapsTrackerTests case. The fix should land on both platforms together.
Reproduce
Unit test in PubkySwapsRouteRepoTest: an advance that always throws a non-NotFound error, with a short poll interval. Assert that the call count stops growing or that the interval grows.
Device: on regtest with the swaps route enabled, commit a swap, stop the swap's Electrum, then relaunch. Count Failed to advance Pubky Swaps route lines per minute.
Activity