AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 37 Bitcoin

routerrpc: implement LSP heuristic and multi-LSP worst-case probing

Public commit record

What the developer wrote

Authored by ziggie

83/100 · Strong
routerrpc: implement LSP heuristic and multi-LSP worst-case probing

This commit implements a comprehensive LSP (Lightning Service Provider)
detection heuristic and updates the payment probing logic to handle
multiple LSPs with worst-case fee estimation.

Key changes:

1. LSP Detection Heuristic (isLSP function):
Implements three rules to detect LSP setups:
- Rule 1: If invoice target is public → NOT an LSP (route directly)
- Rule 2: If at least one destination hop is public → IS an LSP
- Rule 3: If all destination hops are private → NOT an LSP

2. LSP Route Preparation (prepareLspRouteHints function):
- Groups route hints by unique public LSP nodes
- Filters out non-LSP routes based on the heuristic
- Tracks worst-case fees and CLTV delays for each LSP
- Returns adjusted route hints with LSP hop stripped

3. Multi-LSP Probing (probePaymentRequest updates):
- Probes up to 3 unique LSPs maximum (griefing protection)
- Selects the WORST-CASE (most expensive) route for conservative
fee estimation
- Adds comprehensive debug logging for worst-case selection process
- Properly formats vertex logging using %v (calls Vertex.String())

The worst-case approach ensures users won't be surprised by higher fees
when the actual payment is sent, providing a more conservative and
reliable fee estimate.

This commit also adds extensive unit test coverage for the LSP detection
heuristic and route preparation logic.

TestIsLsp:
- Edge cases: empty route hints, nil scenarios
- Rule 1: Public invoice target (3 tests)
- Rule 2: All private destination hops (4 tests)
- Rule 3: At least one public destination hop (6 tests)

TestPrepareLspRouteHints:
- LSP grouping and filtering logic
- Worst-case fee selection across route hints
- Worst-case CLTV delta tracking
- Adjusted route hints validation (LSP hop stripped)
- Multi-LSP scenarios with different fees
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit rewrites how the LND Lightning node's fee-estimation probing handles invoices that route through Lightning Service Providers (LSPs). It changes the LSP-detection rules, probes up to three distinct public LSPs, and returns the most expensive (worst-case) fee estimate rather than a single or cheapest estimate. The change is a defensive feature/refactor, not a clear vulnerability fix, but it alters security-relevant fee and route logic and removes an older public-channel check in favor of a graph-membership check.

Recommended action

Treat as a behavior-changing refactor with security relevance. Review the new isLSP rules for false negatives/positives, ensure HasNode correctly identifies public nodes, verify worst-case selection cannot be gamed by malicious LSPs to inflate estimates, and confirm MaxLspsToProbe adequately bounds probe cost. No immediate patch urgency is indicated by the commit itself.

Security signals we found

01

Changes security-relevant fee-estimation and route-hint handling logic

02

Replaces channel-publicity check with graph node-membership check (HasNode)

03

Caps LSP probes at 3 to limit griefing/DoS surface

04

Returns worst-case (most expensive) fee estimate, a conservative change

05

Adds extensive unit tests for LSP detection and route preparation

06

No explicit vulnerability disclosure or CVE referenced in commit

Risk score

Why this scored 37/100

Our methodology →
Potential impact 8/30
Exploitability 6/25
Stealth signal 5/15
Affected reach 7/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.