Repository navigation
Add non-paying circular route quotes constrained to exact local channels - #1220
Open
hudhaifahz wants to merge 1 commit into
Open
hudhaifahz wants to merge 1 commit into
hudhaifahz wants to merge 1 commit into
Conversation
Extract non-paying route quotation from getAlby#115 and adapt it to current upstream. Pin both local endpoints, preserve fee limits, and expose estimates through Rust and UniFFI without payment-store or execution changes. Test parallel channels, aliases, and multipart routes. AI disclosure: prepared with OpenAI Codex; CodeRabbit CLI assisted review.
|
I've assigned @tnull as a reviewer! |
hudhaifahz
marked this pull request as ready for review
November 6, 2026 05:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applications planning a channel rebalance need to choose the outgoing and returning channels, including when several channels connect to the same peer. This adds
Bolt11Payment::quote_circular_routeand Rust/UniFFI quote records exposing the estimated paths and fees for that exact pair. Quoting creates no invoice, probe, HTLC, or payment-store entry.Approach
The router receives only the selected outgoing channel as a first hop and a route hint for the selected incoming channel. Since ordinary LDK pathfinding rejects payer == payee, the search targets a fresh synthetic recipient behind the incoming peer. Before returning a quote, every path is checked against both endpoint channel IDs and peer identities; only the terminal synthetic identity is then replaced with the local node. Synthetic payment parameters are discarded.
The search uses the local node's BOLT11 feature support, current in-flight HTLCs, channel capacities, incoming forwarding policy, and routing configuration. This permits multipart estimates while keeping the same selected first and last channel on every path. An unset fee cap preserves LDK's default; an explicit zero cap stays zero. Ambiguous user channel IDs are rejected. A quote is an estimate, not a liquidity reservation or a guarantee of payment success.
Scope and provenance
This extracts the route-quotation work from getAlby/ldk-node#115, source commit
70965f2e58936c0893c48ee0cc1788b84164a4e2, and adapts it to upstream main79e4d92ae73c753dd64ee68ed8cb599cda8af8c7.There are no payment-storage changes, new dependencies, swaps, UI changes, or automatic rebalancing in this PR. It does not enable circular sending. The older fork's durable preparation, exact receiving-channel enforcement, and restart recovery are deferred for a separate design review. Opaque serialized routes are deliberately absent from the public quote API so this PR does not establish an execution or durable serialization contract.
Validation
cargo +1.91.1 test --lib: 383 passed.cargo +1.91.1 test --no-default-features --features uniffi-default --lib: 382 passed.RUSTDOCFLAGS=-D warnings.Checks ran on macOS ARM64. Formatting used the repository-pinned
nightly-2026-09-22.The new pathfinding tests use LDK's in-process functional network. They do not send real payments. External Bitcoin Core/electrs integration and the full cross-platform CI matrix remain for upstream CI.
Review focus
Is
Bolt11Paymentthe preferred location for this quote-only API, and is the synthetic-destination route-hint approach acceptable as an initial circular-routing primitive? The intent is to contribute this functionality to shared upstream ownership before proposing the larger payment lifecycle.AI disclosure: implementation, adaptation, tests, and this description were prepared with OpenAI Codex. CodeRabbit CLI was used for automated review; its findings are assessed rather than treated as a security audit.