Repository navigation
Description
Expected Behavior
A wallet that owns more than one identity should stay fully discoverable across launches. If a gap-limit scan could not probe every index, a later launch should scan again until one scan has completed cleanly.
Current Behavior
An identity hidden by a failed probe can stay hidden permanently, because nothing re-scans once any identity is on file.
The chain, all in packages/rs-platform-wallet:
ScanTally::is_trustworthy(wallet/identity/network/discovery.rs:595) isidentities_seen > 0 || failed_probes == 0. A scan that saw an identity at index 0 and got no answer at index 1 returnsOk, and logs its own caveat: "an identity at a failed index may be missing until the next scan" (discovery.rs:468). That is correct as far as it goes — the identities it did find are persisted, and discarding them would be worse.PlatformWalletManager::start_wallet_subsystems(manager/startup.rs:394) skips discovery entirely whenever any identity is already on file. Introduced in feat(platform-wallet): own the DashPay startup ordering instead of each client #4359 so a warm launch costs no Keychain round trip and no Platform probes.- So there is no next scan. The identity at the failed index stays missing for the life of the installation.
The budget-expiry path has the same shape: within_budget returns None, the code consults local state, finds the sighting that was persisted before cancellation, and records it as a warm launch.
On iOS the only automatic fallback has the identical gate — DWCurrentUserIdentityInfo.recoverIfNeeded scans only when there are no local identities at all ("no local identities; scanning seed from index 0"). The one path that recovers from this is the manual Settings → Identities → Discover button.
Possible Solution
Persist whether the last gap-limit scan completed cleanly, and let the warm-launch shortcut apply only when it did. ScanTally already knows failed_probes at the point the verdict is made; it just has nowhere to record it.
Cheaper alternatives were checked and do not work:
- Infer it from the local index set. A hole below the maximum known index (identities at 0 and 2, nothing at 1) is visible via
IdentityEntry::identity_index. The case that matters is not: found at 0, failed at 1, identity really at 1 leaves the local set{0}, which is byte-for-byte what a clean scan of a single-identity wallet leaves. - Reuse existing storage.
sqlite/schema/blob.rsis a codec, not a KV table.WalletMetadataEntryis emitted only at registration and requiresnetwork+wallet_group_id, neither of which a scan has to hand.
So it needs a column and a refinery V002 (only V001 exists today), which is a schema-version bump: a database migrated forward is refused by older app binaries. That is why it is filed rather than folded into #4359.
Dropping the shortcut instead would also close it, at the cost of ~5 probes (IDENTITY_GAP_LIMIT), each a Platform fetch plus a DPNS lookup, plus a Keychain round trip, before every Core SPV start — the cost review specifically asked to remove.
Steps to Reproduce (for bugs)
- Restore a seed that owns identities at registration indices 0 and 1.
- Make the probe for index 1 fail while index 0 succeeds (drop the DAPI response, or restore while the network is flaky).
- The scan returns
Okwith identity 0 and warns about one unanswered probe. Identity 0 is persisted. - Relaunch.
start_wallet_subsystemssees a local identity and skips discovery — identity 1 is never found, on this launch or any later one.
Context
Found by automated review on #4359, which introduced the warm-launch shortcut. Verified against source rather than reproduced on-device. Impact is limited to multi-identity wallets, and only when a probe fails at exactly the hidden index — but the failure is silent and permanent, and the user-visible symptom (a missing identity and its DPNS name after a restore) reads as data loss.
Your Environment
- Version used:
v4.2-dev(behaviour introduced by feat(platform-wallet): own the DashPay startup ordering instead of each client #4359) - Environment name and version (e.g. Chrome 39, node.js 5.4):
rs-platform-wallet,rs-platform-wallet-storage - Operating System and version (desktop, server, or mobile): affects every host; iOS confirmed to have no automatic remedy
- Link to your project: dashpay/platform
Activity
fix(platform-wallet): close three gaps review found in the bring-up h…