Skip to content

feat: add support for route hints from private channels when creating invoices#3475

Open
pradip-1111 wants to merge 2 commits into
getAlby:masterfrom
pradip-1111:feature-route-hints-private-channels
Open

feat: add support for route hints from private channels when creating invoices#3475
pradip-1111 wants to merge 2 commits into
getAlby:masterfrom
pradip-1111:feature-route-hints-private-channels

Conversation

@pradip-1111

@pradip-1111 pradip-1111 commented Jan 19, 2026

Copy link
Copy Markdown

This PR adds opt-in support for including route hints from private channels when creating invoices.

Motivation:
Users with only private inbound liquidity (e.g. via LSPs) currently experience failed payments when invoices do not include route hints. This improves reliability and UX for such setups.

Changes:

  • Added includePrivateChannels flag to MakeInvoiceArgs
  • Propagated the flag through background API and message types
  • Updated LND and LNC connectors to include private channels when requested
  • Added a UI toggle on the Receive Invoice screen

Verification:

  • Create an invoice with “Include private channels” enabled
  • Decode the invoice and verify route_hints are present when private channels exist

Summary by CodeRabbit

  • New Features
    • Added a checkbox on the invoice creation form to let users opt in to include private channels when generating an invoice (off by default). This enables wider routing options for payments when selected.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 19, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds an optional boolean flag includePrivateChannels to the invoice creation flow and propagates it from the UI form through the client API, background action, connector interfaces, and into LNC/LND invoice creation payloads.

Changes

Cohort / File(s) Summary
UI Form Layer
src/app/screens/ReceiveInvoice/index.tsx
Added includePrivateChannels boolean to form state, updated change handler and defaults, added checkbox UI, and included flag in invoice creation request
Client API & Types
src/common/lib/api.ts, src/types.ts
Extended makeInvoice signature and MessageMakeInvoice args to accept includePrivateChannels; passed flag in message request payload
Background Action
src/extension/background-script/actions/ln/makeInvoice.ts
Forwarded includePrivateChannels from message args into connector makeInvoice invocation
Connector Interface & Implementations
src/extension/background-script/connectors/connector.interface.ts, src/extension/background-script/connectors/lnc.ts, src/extension/background-script/connectors/lnd.ts
Added optional includePrivateChannels to MakeInvoiceArgs; passed as private (LNC/LND) when calling underlying addInvoice endpoints

Sequence Diagram(s)

sequenceDiagram
  participant UI as UI\n(ReceiveInvoice)
  participant API as Client\nAPI (makeInvoice)
  participant BG as Background\nAction (makeInvoice)
  participant Conn as Connector\n(LNC / LND)

  UI->>API: makeInvoice({ amount, memo, includePrivateChannels })
  API->>BG: msg.request("makeInvoice", { amount, memo, includePrivateChannels })
  BG->>Conn: connector.makeInvoice({ amount, memo, includePrivateChannels })
  Conn->>Conn: includePrivateChannels -> map to payload.private
  Conn->>Conn: call addInvoice / POST create invoice
  Conn-->>BG: invoice response
  BG-->>API: response
  API-->>UI: invoice result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A little box I gently tick,
From form to API it hops so quick,
Background hums and connectors send,
Private paths now join the send,
An invoice bound, on hops we stick.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature being added: support for route hints from private channels when creating invoices, which aligns with the changeset's primary objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/app/screens/ReceiveInvoice/index.tsx`:
- Around line 80-87: The state update in setFormData unnecessarily spreads
formData twice; edit the update in ReceiveInvoice's handler so it only spreads
formData once (keep a single ...formData) before applying the dynamic key
[event.target.name] (handling checkbox via (event.target as
HTMLInputElement).checked or event.target.value.trim()) to eliminate the
redundant duplicate spread.

Comment thread src/app/screens/ReceiveInvoice/index.tsx

@pradip-1111 pradip-1111 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

i have updated

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