Skip to content

Fix double spend bug#514

Closed
dewabisma wants to merge 3 commits into
mainfrom
beast/fix-double-spend-bug
Closed

Fix double spend bug#514
dewabisma wants to merge 3 commits into
mainfrom
beast/fix-double-spend-bug

Conversation

@dewabisma

@dewabisma dewabisma commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add early guard on confirmSend
  • Only send the same extrinsic without creating new one that cause nonce to be incremented
  • Remove excessive looping on app level, only rely on SDK level

Note

High Risk
Changes core transaction submission and nonce handling for all sends; incorrect retry or hash logic could still drop or mis-track in-flight transfers.

Overview
Fixes a double-spend risk where app-level submission retries re-ran the builder and signed new extrinsics (incrementing nonce) while an earlier attempt might already be in the pool.

Mobile: TransactionSubmissionService drops maxRetries and the recursive retry loop in _submitAndTrackBackground; each user action triggers a single submissionBuilder() call, with RPC resilience documented as living in SubstrateService.submitExtrinsic. Review send adds an early if (_submitting) return on confirm to block duplicate taps.

SDK: submitExtrinsic now builds and signs the payload once, then retries broadcasting the same signed bytes. New extrinsic_submission_utils treats Substrate 1013 / already imported as success by returning localExtrinsicHash(extrinsic) so tracking can continue without re-signing. Unit tests cover the helpers.

Reviewed by Cursor Bugbot for commit f4eba5f. Configure here.

@dewabisma dewabisma requested a review from n13 June 10, 2026 08:23
@n13

n13 commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Same as #515

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.

2 participants