Repository navigation
fix(dashpay): recover an interrupted identity registration instead of double-charging - #867
Merged
romchornyi merged 2 commits intoJul 24, 2026
Conversation
… double-charging When a create-username flow was interrupted (force-quit) after the Core asset lock was broadcast but before the identity/DPNS name completed, the registration was stuck "Pending" forever with no resume path. Re-entering the flow started a fresh registration that stranded a second asset lock (double-charge) and failed with "a unique key with that hash already exists" once the first attempt had registered the identity keys on Platform — leaving a funded identity with no name and no retry. Detect a recoverable Core asset lock on re-entry (`RegistrationRecoveryLock`): resume the original outpoint via `resumeIdentityWithAssetLock` (no new payment), skip `IdentityCreate` when the identity already exists locally or on Platform, and reconcile the consumed lock. The create-username screen surfaces this as a "Finish your registration" banner + "Finish registration" action (no second payment); the pending funding row reads "Pending — tap to finish". Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Why: - PR #866 changed contested identity funding while PR #867 had added the registration recovery branch in the same coordinator. What: - keep the interrupted-registration recovery flow intact - fund new contested Core and Platform identities with the contested amount Validation: - xcodebuild dashpay for a generic iOS Simulator succeeded
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue being fixed or feature implemented
An interrupted create-username flow (force-quit after the Core asset lock was broadcast but before the identity / DPNS name completed) was left stuck "Pending" forever with no resume path. Re-entering the flow was not blocked and did not resume — it started a fresh registration that:
SDK error: Drive internal error: … a unique key with that hash already existsonce the first attempt had already registered the identity keys on Platform,leaving a funded identity with no name and no retry path (P0).
What was done?
On re-entry,
DWIdentityRegistrationCoordinator.startCreateUsernamenow detects a recoverable Core asset lock (RegistrationRecoveryLock, keyed by the persisted outpoint) and recovers instead of re-paying:resumeIdentityWithAssetLock(no new payment);IdentityCreatewhen the identity already exists locally or on Platform (handles the "unique key already exists" seam);Consumed.UI:
CreateUsernameViewModel.hasPendingRegistrationRecoverydrives a "Finish your registration" banner ("Your previous payment was found. Continue to finish creating the identity and username without paying again."), the primary action becomes "Finish registration", and no second payment is requested.Added
DWRegistrationPhaseAdapterTestscases for the recovery phase mapping.How Has This Been Tested?
Manual smoke on testnet, on device (iPhone 17 Pro):
Known follow-up (out of scope here): the recovery persists only the asset-lock outpoint, not the intended username — so the name is re-typed on resume and could diverge from the original. No fund loss (the identity is name-independent); tracked as a separate P2/P3 to persist + pre-fill the intended label.
(No runnable automated test — the unit-test target is currently broken; the new
DWRegistrationPhaseAdapterTestscases are compile-ready, verified via testnet smoke.)Breaking Changes
None.
Checklist:
For repository code-owners and collaborators only
🤖 Generated with Claude Code