Skip to content

Add Node::find_route accessor#29

Merged
amackillop merged 1 commit into
lsp-0.7.0_accept-underpaying-htlcs_with_timing_logsfrom
austin_mdk-864_expose-router
May 14, 2026
Merged

Add Node::find_route accessor#29
amackillop merged 1 commit into
lsp-0.7.0_accept-underpaying-htlcs_with_timing_logsfrom
austin_mdk-864_expose-router

Conversation

@amackillop
Copy link
Copy Markdown

Public wrapper around the previously private _router so callers can resolve a route to a destination without dispatching a payment. The intended consumer is mdk's max-withdrawable estimator, which needs a real route to invert per-hop fees against payout destinations.

The signature takes Option<RouteParametersConfig>. With None the node-wide Config::route_parameters applies, matching the fallback already used by SpontaneousPayment::send_inner. Keeps both call sites consistent.

Error::RouteNotFound is a new variant. This path performs lookup only and never dispatches anything, and a missing route under current liquidity is a routine outcome. The router's &'static str reason is logged at debug level and dropped; callers already get the typed error.

Route and RouteParametersConfig are re-exported from lib.rs for Rust consumers. No UDL bindings in this commit: the uniffi build is currently broken on this branch from drift left over by the rust-lightning upgrade in e935695, so adding more UDL surface would fly blind. A follow-up that fixes the existing drift can layer Route bindings on top.

The returned Route may contain multiple Path entries when max_path_count > 1, since the router is free to split the amount across MPP paths. Callers wanting a single-path response should set max_path_count: 1 in the supplied config.

Public wrapper around the previously private `_router` so callers can
resolve a route to a destination without dispatching a payment. The
intended consumer is mdk's max-withdrawable estimator, which needs a
real route to invert per-hop fees against payout destinations.

The signature takes `Option<RouteParametersConfig>`. With `None` the
node-wide `Config::route_parameters` applies, matching the fallback
already used by `SpontaneousPayment::send_inner`. Keeps both call
sites consistent.

`Error::RouteNotFound` is a new variant. This path performs lookup only
and never dispatches anything, and a missing route under current
liquidity is a routine outcome. The router's `&'static str` reason
is logged at debug level and dropped; callers already get the typed
error.

`Route` and `RouteParametersConfig` are re-exported from `lib.rs` for
Rust consumers. No UDL bindings in this commit: the `uniffi` build is
currently broken on this branch from drift left over by the
rust-lightning upgrade in e935695, so adding more UDL surface would
fly blind. A follow-up that fixes the existing drift can layer
`Route` bindings on top.

The returned `Route` may contain multiple `Path` entries when
`max_path_count > 1`, since the router is free to split the amount
across MPP paths. Callers wanting a single-path response should set
`max_path_count: 1` in the supplied config.
@amackillop amackillop marked this pull request as ready for review May 13, 2026 18:41
@amackillop amackillop requested a review from martinsaposnic May 13, 2026 18:41
@amackillop amackillop merged commit 23c0ff0 into lsp-0.7.0_accept-underpaying-htlcs_with_timing_logs May 14, 2026
6 of 34 checks passed
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.

1 participant