@@ -150,52 +150,58 @@ probing.
150150
151151The heuristic examines the structure of route hints provided in the invoice to
152152identify characteristic LSP patterns. The detection operates on the principle
153- that LSPs typically maintain private channels to their users and appear as the
154- penultimate hop in payment routing .
153+ that LSPs typically maintain private channels to their users and appear as
154+ public nodes in the network, while the final destination is private .
155155
156156``` mermaid
157157flowchart TD
158158 Start([Route Hints Received]) --> Empty{Empty Hints?}
159159 Empty -->|Yes| NotLSP([Not LSP])
160- Empty -->|No| GetFirst[Get First Hint's Last Hop]
161-
162- GetFirst --> CheckPub1{Is Channel<br/>Public?}
163- CheckPub1 -->|Yes| NotLSP
164- CheckPub1 -->|No| SaveNode[Save Node ID]
165-
166- SaveNode --> MoreHints{More Hints?}
167- MoreHints -->|No| IsLSP([Detected as LSP])
160+ Empty -->|No| CheckTarget{Invoice Target<br/>in Graph?}
161+
162+ CheckTarget -->|Yes| NotLSP
163+ CheckTarget -->|No| GetFirstDest[Get First Hint's<br/>Destination Hop]
164+
165+ GetFirstDest --> CheckPub1{Destination Node<br/>in Graph?}
166+ CheckPub1 -->|Yes| IsLSP([Detected as LSP])
167+ CheckPub1 -->|No| MoreHints{More Hints?}
168+
169+ MoreHints -->|No| NotLSP
168170 MoreHints -->|Yes| NextHint[Check Next Hint]
169-
170- NextHint --> GetLast[Get Last Hop]
171- GetLast --> CheckPub2{Is Channel<br/>Public?}
172- CheckPub2 -->|Yes| NotLSP
173- CheckPub2 -->|No| SameNode{Same Node ID<br/>as First?}
174-
175- SameNode -->|No| NotLSP
176- SameNode -->|Yes| MoreHints
177- ```
178171
179- The detection criteria are:
172+ NextHint --> GetNextDest[Get Destination Hop]
173+ GetNextDest --> CheckPub2{Destination Node<br/>in Graph?}
174+ CheckPub2 -->|Yes| IsLSP
175+ CheckPub2 -->|No| MoreHints
176+ ```
180177
181- - ** All route hints must terminate at the same node ID** - This indicates a
182- single destination behind potentially multiple LSP entry points
178+ The detection follows three simple rules applied sequentially:
183179
184- - ** Final hop channels must be private** - The channels in the last hop of
185- each route hint must not exist in the public channel graph
180+ ** Rule 1: Public Invoice Target → NOT an LSP**
181+ - If the invoice target (destination) is a public node that exists in the
182+ channel graph, the payment can be routed directly to it
183+ - This means it's not an LSP setup, regardless of what route hints are provided
184+ - Example: A well-connected merchant node with route hints for liquidity
185+ signaling
186186
187- - ** No public channels in final hops** - If any route hint contains a public
188- channel in its final hop, LSP detection is disabled entirely
187+ ** Rule 2: Public Destination Hop → IS an LSP**
188+ - If at least one route hint has a destination hop (last hop in the route hint)
189+ that is a public node in the graph, LSP detection is triggered
190+ - This indicates the destination hop is an LSP serving a private client
191+ - The private client is reached through the LSP's private channel
189192
190- - ** Multiple route hints strengthen detection** - While not required,
191- multiple hints converging on the same destination strongly suggest an LSP
192- configuration
193+ ** Rule 3: All Private Destination Hops → NOT an LSP**
194+ - If all destination hops in all route hints are private nodes (not in the
195+ public graph), this is not treated as an LSP setup
196+ - The payment will be routed directly to the invoice destination using the
197+ route hints as additional path information
198+ - This is the standard case for private channel payments
193199
194200This pattern effectively distinguishes LSP configurations from other routing
195201scenarios. For instance, some Lightning implementations like CLN include route
196202hints even for public nodes to signal liquidity availability or preferred
197- routing paths. The heuristic correctly identifies these as non-LSP scenarios by
198- detecting the presence of public channels .
203+ routing paths. The heuristic correctly identifies these as non-LSP scenarios
204+ by Rule 1 ( detecting that the invoice target itself is public) .
199205
200206### How Probing Differs When an LSP is Detected
201207
@@ -432,10 +438,6 @@ appropriately.
432438The ` EstimateRouteFee ` implementation continues to evolve based on real-world
433439usage patterns. Ongoing discussions in the LND community focus on:
434440
435- ** Improved LSP Detection** : Developing more sophisticated heuristics that
436- accurately identify LSP configurations while avoiding false positives for
437- regular private channels.
438-
439441** Multi-Path Payment Support** : Extending fee estimation to support MPP
440442scenarios where payments split across multiple routes.
441443
0 commit comments