Repository navigation
Description
What happens
For a note-consuming shielded spend (transfer, unshield, withdrawal, identity top-up from the pool, identity create from the pool), rs-platform-wallet writes two separate things:
- the pending activity row (
record_pending_activity), which the host persists throughqueue_shielded_changeset, and - the signed transition and its note reservation (
save_spend_then_broadcast→arm_pending_release+arm_redrive_before_broadcast), which the redrive pass and the scan use to resolve it.
They are written one after the other, and they can disagree after a restart:
- Row without a record. If the process exits after (1) and before (2), nothing was broadcast and the notes are free again, but the restored activity row stays
Pending. No redrive record exists and no sighting will ever upgrade it, because the transition was never sent. A screen that shows pending rows (Shielded Activity, or the pending top-ups on SwiftExampleApp's Top Up screen from feat: shield from an identity and top up an identity from the shielded pool in SwiftExampleApp #6051) keeps showing a payment that never left the wallet. - Record without a row.
queue_shielded_changesetlogs a host persistence failure and continues. A spend can therefore be saved and dispatched with no host activity row, so after a restart the host shows nothing for a payment that may execute.
Where it showed up
Review of #6051 (thread: #6051 (comment)). That PR only reads the activity projection; the gap is in the wallet and applies to every note-spend flow, so it is tracked here rather than fixed in the app.
Possible directions
- Have the wallet reconcile on restore: a
Pendinglive row for a note spend with no saved retry record and no reserved notes was never dispatched and can be marked failed. - Or expose the wallet's durable spend-recovery state (as
shieldedIdentityDebitRecoveryRecordsdoes for identity-funded shields) so hosts show that instead of the projection. - Test both write boundaries: exit between (1) and (2), and a failed host write after (2).
SwiftDashSDK prerequisite for DashPay contact withdrawals
dashwallet-ios#1117 is deferring Shielded-funded contact payments until hosts can recover the outcome of the original withdrawal. A contact-payment journal must not treat the activity projection as the authority for whether another payment is safe.
Required contract:
- Return or accept a durable withdrawal operation ID bound to the sending wallet, account, concrete chain scope and destination. The host must be able to recover it when the call is interrupted before returning.
- Expose the authoritative recovery outcome across restart: proven not submitted, still able to execute or rebroadcast, terminal failure, or confirmed transition. Unknown or unreadable recovery state must remain explicit.
- Reconcile activity rows with durable spend state, including a Pending row without an armed spend and an armed spend without a persisted activity row. A missing display row alone must never authorize another payment.
- Distinguish transition confirmation from receipt of the Core payout. A host may lift an unresolved-payment lock only from a definitive recovery outcome, not elapsed device time or recipient nonreceipt.
- Document the lifetime and cleanup of operation records so journal/history consumers agree and successful wallet removal does not leave stale locks.
Acceptance coverage should exercise restart at each persistence boundary, host persistence failure, interruption before the caller receives an operation ID, repeated sync/recovery, and isolation across wallets and named devnets. Verify that a never-submitted attempt becomes terminal without permanently blocking the contact, and that a still-executable attempt cannot enable a duplicate retry.
This issue tracks the recovery prerequisite. Binding execution to an authorized fee ceiling remains separately tracked in #5698.
Activity
QuantumExplorer commentedon Nov 23, 2026
KotlinExampleApp's
TopUpIdentityScreen(#6147,ShieldedDao.observePendingIdentityTopUps) is a second consumer of the kind-9 pending projection, alongside SwiftExampleApp'sTopUpIdentityView. Whichever fix lands here (reconcile on restore, or an FFI that lists note-spend retry records per identity) should switch both screens and add the two write-boundary restart tests. Until then both parity-manifest entries for the shielded top-up stay atrestart: required.fix: keep identity shields and shielded top-ups single-shot across sc…