Skip to content

fix(service): keep the rescan flag until the node reports the rescan over - #166

Open
jvsena42 wants to merge 1 commit into
mainfrom
fix/rescan-flag-survives-lost-rescan
Open

jvsena42 wants to merge 1 commit into
mainfrom
fix/rescan-flag-survives-lost-rescan

Conversation

@jvsena42

Copy link
Copy Markdown
Owner

Part of #164 — the "filters at 51%, then 100% synced in basically no time" report.

Root cause

The service cleared WALLET_NEEDS_RESCAN as soon as the rescanblockchain RPC was accepted. The node keeps its rescan state in memory only (jvsena42/Floresta-mandacaru#45 makes it survive a sleep, but not a process restart), so a rescan lost to an app restart — or one that failed — left getblockchaininfo.rescan_in_progress false exactly like a finished one, and the sync phase became SYNCED with the wallet half scanned. Reproduced on the emulator: the host suspended mid-rescan, the node's rescan died, the app showed "synced" (the failure is only in rescan_error, which the app did not read).

Changes

  • RescanCompletionTracker follows the rescan this process triggered until the node stops reporting it; WALLET_NEEDS_RESCAN is cleared only then and only without a rescan_error.
  • A rescan that ended with an error counts against the WalletRescanGate budget (backoff, give up after 10), one lost to a restart is simply triggered again once the chain is back at the tip and filters are complete.
  • GetBlockchainInfoResponse gains rescan_error.

Tests

RescanCompletionTrackerTest; ./gradlew :app:testDebugUnitTest detekt lintDebug pass.

Independent of #165.

🤖 Generated with Claude Code

…over

`WALLET_NEEDS_RESCAN` was cleared as soon as `rescanblockchain` was accepted.
The node keeps the rescan in memory only, so one lost to an app restart, or
one that gave up, left `rescan_in_progress` false just like a finished one
and the UI jumped to "fully synced" with the wallet half scanned
(#164).

The service now follows the rescan it triggered: the flag is cleared when the
node stops reporting it without a `rescan_error`; a failure counts against the
gate's retry budget and a lost rescan is triggered again once the chain is
back at the tip.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant