Repository navigation
Description
Problem. The tracked-lock table (tracked_asset_locks) is populated ONLY by (a) a local build in-process (asset_lock/build.rs:1219-1231, sole track_asset_lock call site) or (b) DB replay (apply.rs:326-345, load.rs:69-101). There is no chain-driven insertion: core_bridge.rs — the sole consumer of WalletEvent — never emits an asset-lock changeset; dash-spv has no asset-lock concept; the matcher classifies credit outputs (transaction_router/mod.rs:137-158, account_checker.rs:815-860) but the match is consumed only for address-used watermarks (core_bridge.rs:538-552).
Consequences:
- Seed restore on a fresh device permanently loses every pending asset lock (registration, top-up, invitation): the recovery surface is empty,
resume_asset_lockreturnsAssetLockNotTracked, and the funds sit in the OP_RETURN burn with no local record of the credit-output key path. The funding-index watermark is also lost (build.rs:969-1030documents the invitation bearer-key-reuse hazard). - No consumed-state reconciliation: a lock consumed Platform-side but not locally marked stays "resumable" forever; every resume gets the deterministic rejection (the code comments accept this as the UX —
registration.rs:274-279,platform_addresses/fund_from_asset_lock.rs:371-378— but nothing ever self-heals the row). - The one import hook that could help,
asset_lock_manager_recover(rs-platform-wallet-ffi/src/asset_lock/sync.rs:164-214), has zero callers anywhere and requires the caller to already knowfunding_type/identity_index/ the raw tx — i.e. a host-side classifier that does not exist.
Asks (in priority order).
- Consumed reconciliation (small): when a resume is rejected as already-consumed, mark the local row
Consumedso the resumable list self-heals. Mirrors the tombstone the success path writes (tracking.rs:131-168). - Rediscovery (design): wire the existing credit-output match into lock tracking — on scanning an asset-lock tx paying a known identity-funding path, insert a tracked row (
IdentityTopUpNotBound+ status from chain context, e.g.ChainLocked, is the natural shape perresolve_status_with_in_memory,recovery.rs:141-184). This is what makes seed restores recover pending top-ups, and it composes with Issue B (the unbound account is what legacy locks appear on). - Alternatively/meanwhile — make
asset_lock_manager_recoverusable: document + expose it through the SDKs so a host that CAN classify (e.g. dash-wallet scanning its dashj-sidetopupFundingTransactionsduring migration) can import legacy pending locks into the SDK queue. This is the migration path for dash-wallet's legacycheckTopUpsretirement.
Wallet impact. Until 2+3 exist, dash-wallet must keep its legacy dashj top-up recovery path alive behind the cutover flag for all pre-cutover pending top-ups, and seed restores lose SDK-pending top-ups (funds recoverable only by re-running discovery on a device that still has the DB).
Context: dashpay/dash-wallet#1520 (SDK cutover Phase 1B, asset-lock sends) / MO-998. Findings verified against integration/kotlin-sdk-stack + rust-dashcore dev @ 9c87ccb3.
Activity