Skip to content

fix(wallet): show a completing shielded transfer as an ordinary internal transfer - #1212

Merged
romchornyi merged 32 commits into
developfrom
fix/shielded-transfer-in-flight-row
Nov 10, 2026
Merged

romchornyi merged 32 commits into
developfrom
fix/shielded-transfer-in-flight-row

Conversation

@romchornyi

@romchornyi romchornyi commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Part of #1042. Builds against platform v5.1-dev at b0ccf7b5f5 (.platform-ref), which carries dashpay/platform#5460 and dashpay/platform#5476 (onAssetLockBuilt). With dashpay/platform#5460, a Transparent → Shielded transfer from a balance of many small coins no longer fails: the SDK waits a few minutes for a ChainLock and then completes it. During that wait the History row read Pending — tap to finish, and a tap started a second attempt on the same asset lock while the first was still running.

What was done?

  • ShieldedAssetLocksInFlight (in ShieldedTransferCoordinator.swift): a shared, ref-counted registry of the asset locks an attempt is consuming. It releases a claim when the attempt's phase leaves the in-flight states. beginTransfer(consuming:vout:) refuses a resume of a lock that is already claimed with the new CoordinatorError.assetLockInFlight.
  • A fresh Core → Shielded or Core → Platform transfer claims its new lock by the outpoint the SDK reports through onAssetLockBuilt (feat(platform-wallet)!: report a freshly built asset lock's outpoint to the caller platform#5476). The handler runs on the FFI worker thread before the lock's row is persisted, so no surface ever sees the lock unclaimed, and the status poll reads that exact row. "Try again" is armed with the reported outpoint unless the broadcast was definitely rejected. The registry also counts fresh transfers from before their authorization, so a removal (Drop & Rescan, Remove if Not on Network) is refused while one runs.
  • HomeView: an in-flight lock's row shows the ordinary Transparent → Shielded route chip and no finish prompt; taps route as for a normal internal transfer.
  • TxDetailModel / TxDetailViewController: Retry is hidden while the lock is in flight; a tap on a screen opened earlier shows "This transfer is still in progress. Check its status again in a few minutes." instead of doing nothing.
  • AssetLockRecoveryService: the bulk recovery pass skips in-flight locks and does not count them as failures.
  • Max wallet drain (performWalletDrain, from fix(wallet): make Core to Shielded Max restart-safe #1205/feat(wallet): Max to an external shielded address uses the SDK wallet drain #1251): shieldedFundFromWalletDrain reports no built lock, so the drain is claimed by its operation id before the call. The lock's row carries that id; ShieldedTxLookup passes it to every reader (Home row, tx detail, bulk pass, resume gate), and resumeAssetLock re-checks the row it reads. A completed drain keeps its claim until its row reads as finished (consumed or drain-completed), at most 30 s, so its lock is not offered as stuck while the SDK's final status lands. The drain also holds a funding call, so a removal is refused while it runs. feat(platform-wallet): report the wallet drain's built asset lock to the caller, as the other funding calls do platform#5737 asks for the built-lock callback on the drain, which would replace the operation-id claim.
  • A resume the registry refuses leaves one outcome line in the exported log (outcome=skipped reason=in-flight), written by the coordinator.
  • New string added to all Localizable.strings with the English value; translations come through Transifex.

How Has This Been Tested?

DashWalletTests on the iOS 27.1 simulator against b0ccf7b5f5: 1541 tests pass except String_DashWallet.testAssumptionThatCurrencySymbolIsEitherAtTheBeginningOrAtTheEnd, which iterates the simulator's locales and is untouched by this change (green on develop's CI). New tests cover drain claims by operation id, their publication, removal admission and the completed-drain settling (finished, RecoveredFromChain, missing row, timeout, release).

Earlier, testnet, iOS 27 simulator, dashpay Debug, against the SDK from dashpay/platform#5460, wallet of 160 coins of 0.0125 tDASH:

  • shield of ~80 coins: the row stayed an ordinary Internal Transfer · Transparent → Shielded during the ChainLock wait and the transfer completed on its own;
  • a lock left stuck while the app was stopped completed with Finish now after relaunch.

Not exercised on a device yet: the refusal toast on a second Complete Transfer tap during the wait, and a Max drain's History row during its ChainLock wait.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Prevented recovery attempts from interfering with shielded transfers already in progress.
    • Pending transfers are marked recoverable only when recovery is available. If a transfer is already running, retrying it displays a message.
    • Prevented starting another transfer of the same kind while one is already in progress.
    • Prevented removing unconfirmed transactions while a shielded transfer is active, including when a transfer starts during the removal process.
    • Recovery summaries now report transfers that remain in progress.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants