Skip to content

platform-wallet: payment-intent follow-ups (no-capability hosts, chain reconstruction, resume by intent) #5938

Open

Description

@romchornyi

#5930 records the recipient map of an external asset-lock payment (the payment intent) with the lock before broadcast. Its review left three gaps, deferred to keep that PR narrow. All three existed in the base already, and none of them loses funds. Without an intent, an owned resume pays the sender's own Platform address, so the money comes back but the payee is not paid.

1. A host without ASSET_LOCK_PAYMENT_INTENTS still broadcasts

Current. When a payment intent is present but the persister does not advertise the capability, build.rs#L1471-L1488 logs a warning and goes on.

Coverage today. Every in-repo host advertises the capability: SQLite, the FFI bridge with both slots wired, Swift and Kotlin. Only the trait default (NONE) and the test persisters do not.

Proposed. Fail with Persistence before building whenever an intent is present and the capability is missing. Invitations and the drain already fail closed this way. This changes the public API for hosts without the bridge slots, so it needs a maintainer decision.

2. Chain reconstruction cannot tell an external lock from an owned one

Current. Reconstructed and recovered rows get payment_intent: None. See reconstruction.rs#L232-L237 and recovery.rs#L112.

When it bites. Reconstruction only runs for outpoints missing from storage, after a wipe or a restore from seed. Nothing on chain marks a lock as external, because the recipients live only in the Platform transition. After a restore, an external lock whose Platform step never ran can therefore be resumed through the owned path.

Precedent. shielded_recipient has the same gap (#5603).

Design question. An "intent unknown" state would block legitimate owned recovery after a restore. Options are:

  • accept the refund to self;
  • ask the host for the recipients;
  • persist the intent somewhere that survives a wipe.

3. Resuming an intent-bearing lock needs a host-picked account

Current. fund_from_asset_lock_external takes a Platform account and checks that the recorded remainder address belongs to it (fund_from_asset_lock.rs#L725-L736). The example apps' resume screens therefore make the user pick a fresh recipient and account:

  • Swift: FundFromAssetLockPlatformAddressView.swift
  • Kotlin: FundFromAssetLockScreen.kt L248-267

Impact. With several accounts, a valid recorded payment is refused. With no fresh unused address, resume cannot be submitted at all.

Proposed. Add a Rust entry point that resumes an intent-bearing lock by outpoint alone, finds the account that owns the remainder address itself, and is exposed through FFI, Swift and Kotlin. The example apps then drop the picker for such locks.

Context

Review of #5930. Related: #5824, #5924, #5603.

Activity

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