Skip to content

feat(pathRouter): add findPath with configurable fallback threshold - #729

Merged
Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
kingsrichie79-cmyk:feature/fallback-path-routing
Aug 29, 2026
Merged

feat(pathRouter): add findPath with configurable fallback threshold#729
Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
kingsrichie79-cmyk:feature/fallback-path-routing

Conversation

@kingsrichie79-cmyk

Copy link
Copy Markdown
Contributor

Closes #699

Description:
This PR resolves an issue where src/pathRouter.ts would return a hard failure (PathNotFoundError) when no payment paths met the required minimum liquidity threshold on the first attempt.

To provide callers with a viable (even if more costly) route, this update implements a single-retry fallback mechanism that can dynamically relax the cost threshold.

Key Changes & Implementations:

  • Introduced a new FindPathParams interface encompassing sourceAsset, destinationAsset, threshold, and fallbackSlippagePct.
  • Added a new findPath(params) method to the PathRouter class.
  • Configured a fallback check that intercepts empty query results: if no path meets the initial query, it automatically retries with a relaxed threshold computed as threshold * (1 + fallbackSlippagePct/100).
  • Modified PathResult to include an optional usedFallback: true telemetry flag to let callers know when the fallback mechanism was utilized to yield the path.
  • Ensured this fallback retry occurs exactly once to prevent unbounded multi-level chaining.

Acceptance Criteria Met:

  • findPath(params) accepts a fallbackSlippagePct?: number option.
  • When no path meets the primary threshold, the router retries with threshold * (1 + fallbackSlippagePct/100).
  • The returned path from the fallback query includes the usedFallback: true flag.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@kingsrichie79-cmyk Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Kingsman-99
Kingsman-99 merged commit 9bcf29f into Stellar-split:main Aug 29, 2026
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.

pathRouter.ts: Add fallback route when primary payment path is exhausted

2 participants