๐Ÿ”„ Smart Retry

Smart Retry

Automatic transaction retry with priority fee escalation (ร—1.5 per attempt) and intelligent error classification. Never retries program errors.

How It Works

text
Attempt 1: priority 1,000 ยต-lamports โ†’ Timeout
  โ†’ Classify: 'congestion' โ†’ RETRY (ร—1.5 escalation, wait 400ms)
Attempt 2: priority 1,500 ยต-lamports โ†’ BlockhashExpired
  โ†’ Classify: 'expired' โ†’ REBUILD + RETRY (fresh blockhash)
Attempt 3: priority 2,250 ยต-lamports โ†’ Success โœ“

Code Examples

const sig = await flash.executeLocal({
  token: 'SOL', amount: 1000,
  onFunds: async (ixs) => [...ixs, myArbIx],
}, {
  retry: {
    maxAttempts: 3,
    strategy: 'adaptive',   // smart retry with escalation
    onRetry: (attempt, reason) => {
      console.log(`Retry #${attempt}: ${reason}`);
    },
  },
  priorityMicroLamports: 1000,
});

Error Classification

Classified AsError PatternsActionRetried?
expiredBlockhash not found, expired, block height exceededRebuild TX with fresh blockhash + retryโœ…
congestionAll other errors (timeout, network)Priority fee ร—1.5, wait 400ms, retryโœ…
program_errorInstructionError, Custom(...), custom program errorStop immediately โ€” your logic has a bugโŒ Never

Configuration

OptionTypeDefaultDescription
maxAttemptsnumber3Maximum number of send attempts
strategy'none' | 'adaptive'adaptivenone = single attempt, adaptive = smart retry
onRetry(attempt, reason) => voidundefinedCallback fired on each retry for logging
โš ๏ธ Warning
Program errors (logic bugs in your instructions) are never retried. This prevents wasting SOL on transactions that will always fail.
๐Ÿ’ก Tip
When using Jito Bundles, Smart Retry escalates the tip amount instead of the priority fee.