-
Notifications
You must be signed in to change notification settings - Fork 91
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
base: main
Are you sure you want to change the base?
Conversation
a160bf2
to
d0eb977
Compare
d0eb977
to
fe59fed
Compare
82fc329
to
9d47470
Compare
9d47470
to
5e13aa5
Compare
5e13aa5
to
2780049
Compare
Rebased on main after #426 landed. |
115f732
to
a2593ae
Compare
Rebased on main to resolve minor changes. |
1d68d58
to
e3725b4
Compare
Some(Arc::clone(&self.chain_source)), | ||
None, | ||
None, | ||
liquidity_client_config, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do both the LiquidityManager
manager and each LSPS service need a copy of the config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which config are you referring to here? LiquidityClientConfig
? We just give that to the LiquidityManager
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I meant LSPS1ClientConfig
and LSPS2ClientConfig2
. Each config is cloned from the respective LSPS service, but the originals are never used anywhere else, AFAICT. Just wondering why we hang on to those inside each service. Maybe instead the config should be pulled out of the service and have the builder hold Option<(LSPS1Service, LSPS1ClientConfig)>
if the config is not needed later. Then you won't have two copies of each config.
/// [bLIP-51 / LSPS1]: https://github.com/lightning/blips/blob/master/blip-0051.md | ||
/// [`Node::lsps1_liquidity`]: crate::Node::lsps1_liquidity | ||
#[derive(Clone)] | ||
pub struct LSPS1Liquidity { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given LSPS2 channels are JIT, I suppose a similar struct won't be needed there? Perhaps the docs should mention how JIT channels are opened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is one open question I had too, would interested in you opinion: should we move the LSPS2-related methods to a similar handler, or leave them on the Bolt11Payment
handler? We could even consider exposing them on both I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, though perhaps a single liquidity handler would be sufficient (i.e., no need for users to care which BLIP the method is defined in). I'm indifferent as to whether we should keep the method in the Bolt11Payment
handler. But we should probably cross-link the docs where appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(i.e., no need for users to care which BLIP the method is defined in)
Unfortunately I think it does matter, as there are many competing standards (e.g., different JIT-channel protocols), so users are already confused why their wrapped-invoice JIT flow doesn't work with our API, for example. So unfortunately I think we currently (still?) need the spec names front-and-center to reduce confusion and make it really clear what we're supporting and what not. :/
But we should probably cross-link the docs where appropriate.
Yeah, that makes sense, will see to add a note.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I figure there at least be one abstraction for the grouping for LSP spec and method naming can differentiate as needed. But if there are competing standards inside that (or the move to BLIPS obsoletes the grouping), then maybe a separate one is needed.
log_error!( | ||
self.logger, | ||
"Failed to handle response from liquidity service: {:?}", | ||
e | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will e
contain the response?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, yes, it includes the parsed responses, LSPS1OrderStatus
in this case. Given this is Debug
and we'd log any bytestreams as such, this should be safe. But probably better to drop logging them here, as the error is not really dependent on the response
s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm fine with that though maybe include the request_id
instead.
.. 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.
We add the logic required to send `create_order` requests and check on their status.
ff6b600
to
30fc8bf
Compare
We add an `Lsps1Liquidity` API object, mirroring the approach we took with the `payment` APIs.
30fc8bf
to
9cec3f4
Compare
9cec3f4
to
0e590ba
Compare
We add the capability to act as an LSPS1 / bLIP-51 client.