Skip to content

rs-platform-wallet: persist the Orchard recipient of a shielded asset-lock funding with the tracked lock #5603

Closed

Description

@llbartekll

Problem

A Core → Shielded funding (Type 18 ShieldFromAssetLock) is a two-step operation: the asset lock is broadcast first, the shield transition is submitted after the lock is proven. If the host app is killed in between, the transfer is resumed later from the tracked lock. At 84851397d7:

  • TrackedAssetLock / AssetLockEntry carry operation_id, out_point, transaction, account_index, funding_type, identity_index, amount, status, proof — no recipient;
  • a repeated-UUID shielded_fund_from_wallet_drain and the generic shielded_resume_fund_from_asset_lock both build the transition with whatever recipient the current call passes, with no comparison to the original one (fund_from_asset_lock.rs, FromExistingAssetLock);
  • for a drain-tagged lock the generic resume also completes the drain (tracked_operation_id → complete_wallet_drain), so a resume to the wrong recipient is reported as a completed drain.

Every host therefore has to persist the recipient itself and route every resume entry point through it. dashwallet-ios does this with an app-side marker in dashpay/dashwallet-ios#1251 (wallet drain only); typed-amount external sends are still uncovered (dashpay/dashwallet-ios#1253), and a Kotlin host would need the same machinery again.

Proposal

  • Record the Orchard recipient (raw 43 bytes, plus the requested per-recipient credits if any) on the tracked asset lock when a shielded funding is built, durably before dispatch, as operation_id is today.
  • On resume, use the recorded recipient; if the caller passes one that differs, return a typed error instead of paying it. Keep accepting a caller-supplied recipient only for legacy rows with none recorded.
  • Expose it read-only through the FFI / PersistentAssetLock so hosts can show who a pending transfer pays.

Related: #5580 (unauthenticated "already consumed" completion of a drain).

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions