Preserve migration state during multi-account catch-up - #382
Draft
piatoss3612 wants to merge 3 commits into
Draft
Conversation
piatoss3612
force-pushed
the
rowan/fix-migration-account-sync
branch
3 times, most recently
from
July 30, 2026 10:24
c7a90d8 to
78bab6e
Compare
piatoss3612
force-pushed
the
rowan/fix-migration-account-sync
branch
from
August 4, 2026 11:34
fed80c6 to
4dad094
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Vizor stores every Zcash account in one SQLite wallet DB and synchronizes all accounts through one wallet-wide sync loop.
That creates a race when an Ironwood migration is already running and the user imports or creates another account:
The migration task may have passed its catch-up check before the import, then finish after catch-up has started. In the reproduced failure, Account B began syncing from height 0 while Account A's durable migration state regressed from
nextActionHeight=1204to153.This is a shared-state race, not an account-import failure: the new account syncs, but an in-flight migration operation can persist a result calculated from the wrong sync state. The same shared DB also allowed account mutations, sync, sends, and migration writers to contend for SQLite and retain a stale completed-sync snapshot after the account set grew.
Root causes
Solution
Invalidate sync completion when the account set grows
Protect migration state at the commit boundary
This closes both sides of the race:
Preserve progress across internal retries
run_sync_innersession its own retry-progress mapper.Expected behavior
When another account is imported during migration:
Regression coverage
Validation
Validation was repeated after rebasing onto
origin/mainat8191dee08(release/v0.0.43-rc.0).git diff --check: passed.rustScanned=0through1206.broadcast_scheduledphase.nextActionHeightremained1204throughout catch-up instead of regressing to a historical height.Scope boundaries
zcash_client_sqliterc.1 to rc.4 test-DB incompatibility. That RC-only artifact is separate and is not reachable by normal users.