Preserve AddInvoiceData fields across invoice wrappers#268
Merged
starius merged 6 commits intolightninglabs:masterfrom Apr 18, 2026
Merged
Preserve AddInvoiceData fields across invoice wrappers#268starius merged 6 commits intolightninglabs:masterfrom
starius merged 6 commits intolightninglabs:masterfrom
Conversation
Marshal explicit route hints in lightningClient.AddInvoice so the standard invoice path matches AddHoldInvoice. Add regression coverage for direct AddInvoice route hint encoding and for route hint parity between AddInvoice and AddHoldInvoice.
Set FallbackAddr on the standard AddInvoice RPC request so the lightning client preserves explicit on-chain fallback addresses. Extend the existing invoice tests with direct AddInvoice coverage and parity checks against AddHoldInvoice.
Set IsAmp on the standard AddInvoice RPC request so callers can request AMP invoices through lightningClient.AddInvoice. Extend the existing AddInvoice unit test to assert AMP invoice requests preserve the flag on the outgoing RPC payload.
Stop forwarding Hash on the standard AddInvoice path and warn when Hash or HodlInvoice are provided, since callers should use InvoicesClient.AddHoldInvoice for hold invoices. Extend the existing AddInvoice test to assert the standard invoice request omits hold-invoice-only arguments.
Translate BlindedPathCfg into the standard AddInvoice RPC by setting IsBlinded and forwarding MinNumPathHops as the compatible NumHops override. Warn when non-overlapping blinded path settings are provided, and extend the AddInvoice unit test to assert blinded invoice requests preserve the translated RPC fields.
Warn when AddHoldInvoice is called with Amp or BlindedPathCfg, since the hold-invoice RPC cannot represent those inputs. Add coverage to document that the wrapper still forwards the supported request fields unchanged when those unsupported inputs are present.
starius
added a commit
to starius/loop
that referenced
this pull request
Apr 15, 2026
Include lightninglabs/lndclient#268 Preserve AddInvoiceData fields across invoice wrappers TODO: remove go replace.
1 task
hieblmi
approved these changes
Apr 15, 2026
Contributor
hieblmi
left a comment
There was a problem hiding this comment.
LGTM, the warnfs keep the changes backwards compatible!
Contributor
Author
|
Pushed tag |
starius
added a commit
to starius/loop
that referenced
this pull request
Apr 18, 2026
Include lightninglabs/lndclient#268 Preserve AddInvoiceData fields across invoice wrappers
10 tasks
hieblmi
pushed a commit
to hieblmi/loop
that referenced
this pull request
May 5, 2026
Include lightninglabs/lndclient#268 Preserve AddInvoiceData fields across invoice wrappers
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.
Summary
lightningClient.AddInvoicewas silently dropping several fields frominvoicesrpc.AddInvoiceDatawhen building the outgoinglnrpc.Invoicerequest. That meant callers who setRouteHints,FallbackAddr,Amp, orBlindedPathCfgcould get an invoice that ignored those settings.This branch fixes
AddInvoiceto forward all applicable fields on the standard invoice path:RouteHintsFallbackAddrAmpBlindedPathCfg(for the overlapping subset supported by the RPC)It also cleans up hold-invoice semantics on that path.
HashandHodlInvoiceare hold-invoice-specific inputs, solightningClientnow warns when they are passed and no longer forwardsHashintolnrpc.Invoice.RHash, which lnd documents as output-only.For
BlindedPathCfg, onlyMinNumPathHopscan be represented through the standard RPC, so it is mapped tolnrpc.BlindedPathConfig.NumHops. Other blinded-path tuning fields (RoutePolicyIncrMultiplier,RoutePolicyDecrMultiplier,DefaultDummyHopPolicy) have no counterpart in the RPC proto, so the wrapper logs a warning and lnd falls back to its defaults for those.As a follow-up for existing asymmetry,
invoicesClient.AddHoldInvoicenow also warns when callers passAmporBlindedPathCfg, since the hold-invoice RPC has no fields for them.Test Plan
TestLightningClientAddInvoicewith direct regression coverage for: fallback address, AMP, hash/hodl inputs being ignored on the standard invoice path, blinded invoices, blinded invoices withMinNumPathHops == 0, and route hints.assertAddInvoiceArgsfor field-by-field verification of the outgoinglnrpc.Invoicerequest.TestInvoiceClientAddInvoiceParityto compare all shared explicit fields betweenAddInvoiceandAddHoldInvoice:Memo,ValueMsat,DescriptionHash,Expiry,FallbackAddr,CltvExpiry,Private, andRouteHints.PreimageandHashare no longer set together in the sameAddInvoiceData.TestInvoicesClientAddHoldInvoiceIgnoresUnsupportedFieldsto document thatAddHoldInvoicestill forwards the supported request fields unchanged when unsupportedAmp/BlindedPathCfginputs are present.Pull Request Checklist
in
lnd_services.goare updated.macaroon_recipes.goif your PR adds a new method that is calleddifferently than the RPC method it invokes.