-
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 support for liquidity mgmt. via lightning-liquidity
#223
Add support for liquidity mgmt. via lightning-liquidity
#223
Conversation
e8cfd19
to
e12d8d4
Compare
43d5f5f
to
a626584
Compare
6644bd0
to
ba1fd79
Compare
ba1fd79
to
8db5970
Compare
5d597be
to
753be94
Compare
if let Some(lsps2_service) = self.lsps2_service.as_ref() { | ||
if counterparty_node_id != lsps2_service.node_id { | ||
debug_assert!( | ||
false, | ||
"Received response from unexpected LSP counterparty. This should never happen." | ||
); | ||
log_error!( | ||
self.logger, | ||
"Received response from unexpected LSP counterparty. This should never happen." | ||
); | ||
return; | ||
} |
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.
Gotcha. Shuffling things around and doing a pre-match
might help eliminated some duplication (haven't actually tried this):
match event {
Event::LSPS2Client(client_event) => match self.lsps2_service.as_ref() {
Some(lsps2_service) => {
match &client_event {
LSPS2ClientEvent::OpeningParametersReady { counterparty_node_id, .. }
| LSPS2ClientEvent::InvoiceParametersReady { counterparty_node_id, .. } => { /* */},
};
match client_event {
LSPS2ClientEvent::OpeningParametersReady { /* */ .. } => { /* */ },
LSPS2ClientEvent::InvoiceParametersReady { /* */ .. } => { /* */ },
};
},
None => { /* */},
}
};
753be94
to
6beb61c
Compare
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.
Code looks good. What's the testing strategy?
if let Some(lsps2_service) = self.lsps2_service.as_ref() { | ||
if counterparty_node_id != lsps2_service.node_id { | ||
debug_assert!( | ||
false, | ||
"Received response from unexpected LSP counterparty. This should never happen." | ||
); | ||
log_error!( | ||
self.logger, | ||
"Received response from unexpected LSP counterparty. This should never happen." | ||
); | ||
return; | ||
} |
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.
Even if you prefer repeating the counterparty_id
check, it seems better to check lsps2_service
before matching any LSPS2ClientEvent
. But will defer to your preference. I could see indentation getting out of hand.
For now we can only test manually against Testnet/Regtest/Signet nodes (actually, running on Mutinynet). We will also looking to add more testing utils to the |
@jkczyz Let me know when I can squash the fixups. |
Sure, feel free to squash. |
6beb61c
to
e37398e
Compare
Squashed fixups without further changes. |
e37398e
to
ffdf5c0
Compare
Rebased on main to fix CI and also updated to use the just-released Notably, the |
ffdf5c0
to
3248f0d
Compare
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.
LGTM. Please squash.
3248f0d
to
f011f10
Compare
Squashed without further changes. |
... which is nice for consistency reasons. We also fix a minor bug that would have lead us to forget a peer whenever we'd close a channel, even if it wasn't the last one.
... which is nice for consistency reasons.
We add a `LiquiditySource` object that is configurable via builder methods, currently allowing to source inbound liquidity from an LSPS2 service. In the next commit(s) we'll add corresponding API and event handling.
f011f10
to
3c05b17
Compare
Rebased on |
Hi @tnull |
Closes #194
We add initial, alpha-stage support for liquidity-management via LSPS2/
lightning-liquidity
.Draft as still work in progress (and blocked on lightningdevkit/lightning-liquidity#73 / lightningdevkit/lightning-liquidity#74).