Skip to content

feat: add configurable route hints to BOLT11 receive APIs - #2

Merged
kaloudis merged 4 commits into
ZeusLN:zeusfrom
ajaysehwal:feat/route-hints
Jul 29, 2026
Merged

kaloudis merged 4 commits into
ZeusLN:zeusfrom
ajaysehwal:feat/route-hints

Conversation

@ajaysehwal

@ajaysehwal ajaysehwal commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • Add data-carrying RouteHints (None / Automatic / Custom { user_channel_ids }) for BOLT11 invoice creation (replaces the earlier RouteHintsMode + optional IDs shape)
  • Add receive_with_route_hints, receive_variable_amount_with_route_hints, and the matching *_for_hash_with_route_hints variants (Rust + UniFFI)
  • Existing receive* APIs stay on Automatic
  • All modes go through LDK ChannelManager::create_bolt11_invoice via route_hints_override (pinned ZeusLN/rust-lightning)

Custom takes up to 3 UserChannelIds and builds hints from ready channels that have an inbound SCID and forwarding info. Invalid or unusable channel IDs fail immediately with InvalidChannelId (they are not skipped).

@ajaysehwal
ajaysehwal marked this pull request as ready for review July 15, 2026 08:43
@ajaysehwal
ajaysehwal changed the base branch from v0.7.0-zeus-bimodal to zeus July 15, 2026 09:19
@ajaysehwal
ajaysehwal marked this pull request as draft July 15, 2026 12:12
@ajaysehwal
ajaysehwal marked this pull request as ready for review July 16, 2026 08:53

@kaloudis kaloudis left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the branch at e70a3c6. The core mechanics check out: claimability parameters (payment secret registration, MIN_FINAL_CLTV_EXPIRY_DELTA, currency, MPP feature, signature recovery) match what ChannelManager expects per the pinned rust-lightning, cargo check passes with and without --all-features, and uniffi bindgen generates valid Python/Kotlin/Swift bindings including the None variant.

Five inline comments below. Minor notes not worth separate threads:

  • The PR description is stale: it still says unusable channels are skipped, but e70a3c6 made them fail fast.
  • Custom-hint validation runs after create_inbound_payment*. No state leaks (inbound payments are stateless), but validating the hints first is the cleaner fail-fast order and skips pointless key derivation on the error path.
  • sha256::Hash::from_slice(&payment_hash.0) on a fixed [u8; 32] can never fail — sha256::Hash::from_byte_array(payment_hash.0) removes the dead error branch.
  • The *_for_hash receive variants got no route-hints counterpart even though receive_inner now supports the combination — worth deciding whether that asymmetry is intentional before this API ships.

Comment thread src/payment/bolt11.rs Outdated
Comment thread src/payment/bolt11.rs Outdated
Comment thread src/payment/bolt11.rs Outdated
Comment thread src/payment/bolt11.rs Outdated
Comment thread src/payment/bolt11.rs Outdated
@ajaysehwal
ajaysehwal marked this pull request as draft July 23, 2026 14:19
@ajaysehwal
ajaysehwal marked this pull request as ready for review July 28, 2026 12:19
@ajaysehwal
ajaysehwal marked this pull request as draft July 28, 2026 12:19
@ajaysehwal
ajaysehwal marked this pull request as ready for review July 28, 2026 14:13
@ajaysehwal
ajaysehwal requested a review from kaloudis July 28, 2026 14:13
@kaloudis

kaloudis commented Jul 28, 2026

Copy link
Copy Markdown

Three items before merge:

  1. Run cargo fmt. The new code in src/payment/bolt11.rs fails cargo fmt --check (import ordering of bitcoin::hashes::Hash, the RouteHints::Custom match arm, receive_wrapped's signature and several call sites) — this is what's failing the build (…) CI jobs in ~30s. The remaining red checks (check-kotlin, integration tests) are inherited from the zeus base branch and not caused by this PR.

  2. Fix the PR description. It still says "Unusable channels are skipped;" — the implemented behavior (correctly) fails fast with InvalidChannelId instead. The doc comments and UDL already say this; only the description contradicts them.

  3. (Optional) Copy the cap note to the other method docs. The MAX_CUSTOM_ROUTE_HINTS limit is documented on the enum and on receive_variable_amount_for_hash_with_route_hints, but not on the other three *_with_route_hints methods.

@kaloudis
kaloudis merged commit 4abda08 into ZeusLN:zeus Jul 29, 2026
3 of 18 checks passed
kaloudis added a commit to kaloudis/zeus that referenced this pull request Jul 30, 2026
Pulls in ZeusLN/ldk-node#3: DualStore push-safety gate (prevents a
fresh local store from overwriting an existing VSS backup) and
restore-mode VSS error propagation (a failed VSS fetch now fails the
build instead of silently producing a fresh node with no channels).

Also includes the additive BOLT11 route-hints receive APIs from
ZeusLN/ldk-node#2; the uniffi interface change is purely additive and
the uniffi version is unchanged, so the vendored bindings remain
compatible without regeneration.
kaloudis added a commit to kaloudis/zeus that referenced this pull request Jul 30, 2026
Pulls in ZeusLN/ldk-node#3: DualStore push-safety gate (prevents a
fresh local store from overwriting an existing VSS backup) and
restore-mode VSS error propagation (a failed VSS fetch now fails the
build instead of silently producing a fresh node with no channels).

Also includes the additive BOLT11 route-hints receive APIs from
ZeusLN/ldk-node#2; the uniffi interface change is purely additive and
the uniffi version is unchanged, so the vendored bindings remain
compatible without regeneration.
kaloudis added a commit to kaloudis/zeus that referenced this pull request Jul 30, 2026
Pulls in ZeusLN/ldk-node#3: DualStore push-safety gate (prevents a
fresh local store from overwriting an existing VSS backup) and
restore-mode VSS error propagation (a failed VSS fetch now fails the
build instead of silently producing a fresh node with no channels).

Also includes the additive BOLT11 route-hints receive APIs from
ZeusLN/ldk-node#2; the uniffi interface change is purely additive and
the uniffi version is unchanged, so the vendored bindings remain
compatible without regeneration.
kaloudis added a commit to kaloudis/zeus that referenced this pull request Jul 31, 2026
Pulls in ZeusLN/ldk-node#3: DualStore push-safety gate (prevents a
fresh local store from overwriting an existing VSS backup) and
restore-mode VSS error propagation (a failed VSS fetch now fails the
build instead of silently producing a fresh node with no channels).

Also includes the additive BOLT11 route-hints receive APIs from
ZeusLN/ldk-node#2; the uniffi interface change is purely additive and
the uniffi version is unchanged, so the vendored bindings remain
compatible without regeneration.
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.

2 participants