feat: Add client_info to LSPS1, LSPS7, and Flow requests#3810
feat: Add client_info to LSPS1, LSPS7, and Flow requests#3810kaloudis merged 1 commit intoZeusLN:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request standardizes how client applications and node implementations identify themselves to Lightning Service Providers (LSPs). By introducing a dedicated Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a client_info payload to LSP requests, which is a valuable feature for analytics and debugging on the LSP side. The implementation is well-structured with a dedicated utility module and comprehensive tests. My review includes a suggestion for a minor logic refinement in ClientInfoUtils.ts to ensure node_version is only sent when node is also present, which will improve the consistency of the generated payload.
Description
Summary
client_infoto LSPS1, LSPS7, and Flow (JIT) channel requests, identifying the client application and node implementation to the LSPClientInfoUtilshelper builds the payload from the current app version and backend typev/Vprefix from version strings for consistencySpec
Implements the
client_infocommon schema proposed in lightning/blips#69.Rationale
LSPs currently have no standardized way to know which client applications or node implementations are using their services. Previously, we worked around this by overloading the
tokenfield, but this conflicts with its intended purpose (discount codes, API keys). A dedicatedclient_infoobject cleanly separates client identification from authentication, enabling better debugging and analytics.Changes
utils/ClientInfoUtils.ts— New helper that builds aclient_infoobject:app: always"ZEUS"app_version: frompackage.json,vprefix strippednode: mapped from implementation (embedded-lnd/lnd/lightning-node-connect→"LND",cln-rest→"Core Lightning")node_version: from node info,vprefix strippedstores/LSPStore.ts— Sendsclient_infoin:lsps1CreateOrderREST()— JSON bodylsps1CreateOrderCustomMessage()— JSON-RPC paramslsps7CreateOrderCustomMessage()— JSON-RPC paramsgetZeroConfInvoice()(Flow/proposal) — JSON bodyutils/ClientInfoUtils.test.ts— 20 tests covering version prefix stripping, backend name mapping, missing fields, unknown backends, and payload shapes for all three interfacesExample payload
{ "client_info": { "app": "ZEUS", "app_version": "0.13.0-prealpha", "node": "LND", "node_version": "0.18.4-beta" } }PR Type
This pull request is categorized as a:
Checklist
yarn run tscand made sure my code compiles correctlyyarn run lintand made sure my code didn’t contain any problematic patternsyarn run prettierand made sure my code is formatted correctlyyarn run testand made sure all of the tests passTesting
If you modified or added a utility file, did you add new unit tests?
I have tested this PR on the following platforms (please specify OS version and phone model/VM):
I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):
Locales
Third Party Dependencies and Packages
yarnafter this PR is merged inpackage.jsonandyarn.lockhave been properly updatedOther: