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
Shielded sync: fence post-scan redrive and activity work against wallet lifecycle changes #5675
After a shielded sync pass's note scan commits, NetworkShieldedCoordinator::sync (packages/rs-platform-wallet/src/wallet/shielded/coordinator.rs) keeps working from its pre-scan subwallets snapshot:
redrive_pending_spends / release_stranded_spends;
balances_across;
derive_activity_into_changeset, which writes activity rows;
redrive_pending_identity_shields.
Several of these await network round trips. An unregister_wallet, or a re-bind that drops or re-keys an account, can purge a wallet in between. The later store writes, redrive broadcasts and persister callbacks in these helpers have no lifecycle check, so they can recreate activity or redrive state for a wallet the store just forgot, or notify the host about it.
This sequence predates #5277: the base sync() runs the same steps on the same snapshot without a fence. #5277 only fences the scan commit (StoreEpoch) and the final changeset fan-out (queue_pass_changeset, which drops purged subwallets). It doesn't widen this window. Before #5277, a lifecycle change issued mid-scan queued on the store lock and ran exactly here; now it supersedes the pass.
Proposed direction
Give the post-scan helpers the same rule as the fan-out: before each store write or host notification for a subwallet, check EpochWatch::state_kept (or the wallet generation) under the store guard, and skip subwallets whose state was purged since the pass watched the epoch. Redrive decisions for a purged subwallet should be dropped rather than broadcast.
Tests: unregister / dropping re-bind between the scan commit and each helper, asserting no store rows, redrive records or host callbacks for the purged subwallet.
Activity