Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LSPS1 client-side integration #418

Merged
merged 7 commits into from
Feb 6, 2025

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented Dec 4, 2024

We add the capability to act as an LSPS1 / bLIP-51 client.

@tnull tnull marked this pull request as draft December 4, 2024 14:49
@tnull tnull force-pushed the 2024-07-lsps1-integration branch from a160bf2 to d0eb977 Compare December 4, 2024 14:55
@tnull tnull force-pushed the 2024-07-lsps1-integration branch from d0eb977 to fe59fed Compare December 10, 2024 13:37
@tnull tnull force-pushed the 2024-07-lsps1-integration branch 2 times, most recently from 82fc329 to 9d47470 Compare January 10, 2025 12:09
@tnull tnull force-pushed the 2024-07-lsps1-integration branch from 9d47470 to 5e13aa5 Compare January 16, 2025 09:33
@tnull tnull marked this pull request as ready for review January 16, 2025 09:33
@tnull tnull added this to the 0.5 milestone Jan 16, 2025
@tnull tnull force-pushed the 2024-07-lsps1-integration branch from 5e13aa5 to 2780049 Compare January 17, 2025 08:47
@tnull
Copy link
Collaborator Author

tnull commented Jan 17, 2025

Rebased on main after #426 landed.

@tnull tnull mentioned this pull request Jan 17, 2025
10 tasks
@tnull tnull force-pushed the 2024-07-lsps1-integration branch 2 times, most recently from 115f732 to a2593ae Compare January 30, 2025 13:19
@tnull
Copy link
Collaborator Author

tnull commented Jan 30, 2025

Rebased on main to resolve minor changes.

@tnull tnull force-pushed the 2024-07-lsps1-integration branch 2 times, most recently from 1d68d58 to e3725b4 Compare January 30, 2025 13:41
@tnull tnull requested a review from jkczyz January 30, 2025 14:02
tnull added 2 commits February 1, 2025 08:59
.. to align with the rest of the APIs where we usually go `node_id`,
`address`, etc.
We add support for LSPS1 liquidity sources. To this end we slightly
refactor our logic to first create a `LiquiditySourceBuilder` that then
can be used to `build()` the `LiquiditySource` with the configured
services.
@tnull tnull force-pushed the 2024-07-lsps1-integration branch 4 times, most recently from 9cec3f4 to 0e590ba Compare February 1, 2025 09:09
tnull added 3 commits February 6, 2025 10:50
We add the logic required to send `create_order` requests and check on
their status.
We add an `Lsps1Liquidity` API object, mirroring the approach we took
with the `payment` APIs.
@tnull tnull force-pushed the 2024-07-lsps1-integration branch from 0e590ba to b1a277c Compare February 6, 2025 09:55
@tnull
Copy link
Collaborator Author

tnull commented Feb 6, 2025

Now went ahead and squashed fixups, including the doc changes:

> git diff-tree -U2 0e590ba9 b1a277c6
diff --git a/src/liquidity.rs b/src/liquidity.rs
index 7414260c..cbc19954 100644
--- a/src/liquidity.rs
+++ b/src/liquidity.rs
@@ -224,9 +224,9 @@ where
                                                match sender.send(response) {
                                                        Ok(()) => (),
-                                                       Err(e) => {
+                                                       Err(_) => {
                                                                log_error!(
                                                                        self.logger,
-                                                                       "Failed to handle response from liquidity service: {:?}",
-                                                                       e
+                                                                       "Failed to handle response for request {:?} from liquidity service",
+                                                                       request_id
                                                                );
                                                        },
@@ -285,9 +285,9 @@ where
                                                match sender.send(response) {
                                                        Ok(()) => (),
-                                                       Err(e) => {
+                                                       Err(_) => {
                                                                log_error!(
                                                                        self.logger,
-                                                                       "Failed to handle response from liquidity service: {:?}",
-                                                                       e
+                                                                       "Failed to handle response for request {:?} from liquidity service",
+                                                                       request_id
                                                                );
                                                        },
@@ -343,9 +343,9 @@ where
                                                match sender.send(response) {
                                                        Ok(()) => (),
-                                                       Err(e) => {
+                                                       Err(_) => {
                                                                log_error!(
                                                                        self.logger,
-                                                                       "Failed to handle response from liquidity service: {:?}",
-                                                                       e
+                                                                       "Failed to handle response for request {:?} from liquidity service",
+                                                                       request_id
                                                                );
                                                        },
@@ -390,9 +390,9 @@ where
                                                match sender.send(response) {
                                                        Ok(()) => (),
-                                                       Err(e) => {
+                                                       Err(_) => {
                                                                log_error!(
                                                                        self.logger,
-                                                                       "Failed to handle response from liquidity service: {:?}",
-                                                                       e
+                                                                       "Failed to handle response for request {:?} from liquidity service",
+                                                                       request_id
                                                                );
                                                        },
@@ -442,9 +442,9 @@ where
                                                match sender.send(response) {
                                                        Ok(()) => (),
-                                                       Err(e) => {
+                                                       Err(_) => {
                                                                log_error!(
                                                                        self.logger,
-                                                                       "Failed to handle response from liquidity service: {:?}",
-                                                                       e
+                                                                       "Failed to handle response for request {:?} from liquidity service",
+                                                                       request_id
                                                                );
                                                        },
@@ -964,6 +964,11 @@ pub(crate) struct LSPS2BuyResponse {
 /// Should be retrieved by calling [`Node::lsps1_liquidity`].
 ///
+/// To open [bLIP-52 / LSPS2] JIT channels, please refer to
+/// [`Bolt11Payment::receive_via_jit_channel`].
+///
 /// [bLIP-51 / LSPS1]: https://github.com/lightning/blips/blob/master/blip-0051.md
+/// [bLIP-52 / LSPS2]: https://github.com/lightning/blips/blob/master/blip-0052.md
 /// [`Node::lsps1_liquidity`]: crate::Node::lsps1_liquidity
+/// [`Bolt11Payment::receive_via_jit_channel`]: crate::payment::Bolt11Payment::receive_via_jit_channel
 #[derive(Clone)]
 pub struct LSPS1Liquidity {

@tnull tnull merged commit f1fdee5 into lightningdevkit:main Feb 6, 2025
7 of 14 checks passed
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.

2 participants