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 lnd support #24

Merged
merged 8 commits into from
Dec 6, 2024
Merged

add lnd support #24

merged 8 commits into from
Dec 6, 2024

Conversation

JssDWt
Copy link
Collaborator

@JssDWt JssDWt commented Nov 30, 2024

Add LND support as a lightning backend for swapd.
Lots of changes to the integration tests (can be ignored for review as long as they work)

Issues with rustls and LND's selfsigned certificate make it impossible to connect to LND out-of-the-box. So LND has to include lightningnetwork/lnd#9325 to work with swapd.

Add LND support to swapd. The lightning client can now be either a cln
client or lnd client. It is determined whether an LND or CLN client is
used based on the respective grpc_address parameters.

LND requires a maximum fee to the `SendPaymentV2` call, so CLN now also
takes into account a maximum fee.

LND doesn't have out-of-the-box support for labels on payments. Labels
are used to associate payment requests inside swapd with the payments on
the node. This is to associate utxos used for the payment with the
actual payout. LND has its own internal table associating labels to the
payment index on the node.
lnd needs a time limit in send_payment_v2, so cln now also gets a time
limit. The lnd certificate is a ca certificate, not the tls certificate.
@JssDWt JssDWt force-pushed the jssdwt-lnd-support branch from b70486d to 602372c Compare November 30, 2024 20:23
cln and lnd now have their own fixtures, custom made for swapd. cln
wraps the LightningNode object from pyln-testing, while lnd is a newly
built fixture/factory for the node. They both share the same interface
so tests can call functions on the node to execute actions.

There is a parameter `--node` added to the tests in conftest.py. lnd,
cln or both can be passed there. By default it tests both. If one of the
flags is set it only tests swapd with that specific node implementation.
The 'user' is always a core lightning node. Only the node attached to
swapd is switched based on context.

The bitcoind fixture had to be copied from pyln-testing, because it
needed zmqpubrawblock and zmqpubrawtx on startup.
the lightningd factory from pyln-testing has too many teardown checks.
They are not useful for swapd cases, so create our own factory.
@JssDWt JssDWt force-pushed the jssdwt-lnd-support branch from d70e242 to cf6e659 Compare November 30, 2024 22:14
@JssDWt JssDWt requested review from roeierez and yaslama November 30, 2024 22:17
@JssDWt JssDWt marked this pull request as ready for review November 30, 2024 22:17
@JssDWt JssDWt merged commit cf6e659 into main Dec 6, 2024
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.

1 participant