Skip to content

feat(routing): add route scoring to WaterfallRouter (#777) - #822

Open
ZacLou wants to merge 1 commit into
Stellar-split:mainfrom
ZacLou:feat/waterfall-router-scoring-777
Open

feat(routing): add route scoring to WaterfallRouter (#777)#822
ZacLou wants to merge 1 commit into
Stellar-split:mainfrom
ZacLou:feat/waterfall-router-scoring-777

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 5, 2026

Copy link
Copy Markdown

Adds optional route scoring so higher-priority tiers are tried first, regardless of declaration order.

Changes

  • WaterfallTier gains optional score?: number field (default 0)
  • plan() sorts tiers by score descending before execution
  • JavaScript's stable sort preserves declaration order for equal scores
  • Original config.tiers array is never mutated
  • Tests: test/waterfallRouterScore.test.ts covers sorting, tie-breaking, missing score, and immutability

Closes #777

- Add optional score field to WaterfallTier interface
- Sort tiers by score descending before waterfall execution
- Stable sort preserves declaration order on ties
- Missing score defaults to 0
- Add unit tests for sorting, tie-breaking, and immutability

Closes Stellar-split#777
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.

Add route scoring to select the optimal path in WaterfallRouter

1 participant