Skip to content

Issue 18: Resilient On-Chain Transaction Re-Submission Broadcast Queues #17

Description

@elizabetheonoja-art

Scope

File: src/hooks/useRetryQueue.ts

Problem

Transactions submitted to Soroban RPC may fail due to network congestion, sequence number collisions, or temporary node unavailability. The current approach shows a generic error toast and requires the user to manually retry. For critical operations like tariff updates or collateral deposits, automatic retry with exponential backoff is essential.

Requirements

  1. Implement a transaction retry queue with states: pending → submitted → confirmed | failed.
  2. On enqueue(id, maxRetries):
    • Add a new transaction with retryCount: 0.
    • Set status: "pending".
  3. updateTxHash(id, txHash) transitions to submitted.
  4. markConfirmed(id) finalizes.
  5. markFailed(id, error):
    • If retryCount < maxRetries, schedule auto-retry with delays: [1s, 5s, 15s, 30s, 60s].
    • Else mark as failed permanently.
  6. retry(id) manually triggers immediate retry.
  7. purge() clears all pending timers and state.

Resolution Strategy

  • useRef<Map<string, setTimeout>> for active retry timers — cleanup on unmount.
  • maxRetries default: 5.
  • Exponential delays capped at 60s.
  • Queue is persisted across browser reloads via localStorage (extract serialization).

Tags

hooks, transactions, retry, reliability

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions