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 core-lightning as backend lightning node vendor #611

Merged
merged 46 commits into from
May 22, 2023

Conversation

Reckless-Satoshi
Copy link
Collaborator

What does this PR do?

Fixes #196 . This PR adds support for core-lightning (CLN) as lightning node vendor. This PR merges into main the work of @daywalker90 for the rewarded task #196 .

Coming from :
#593
#435
#433
#431

Some considerations
Using CLN on mainnnet as the RoboSats backend is strongly discouraged. Yet, using it on testnet and breaking things, is strongly encouraged. CLN has been very little tested as a RoboSats backend compared to LND, and it is likely we still have to find and fix some bugs.

Only the Dockerfile in docker/cln will have all the necessary libraries to work as a RoboSats backend. Our Dockerfile currently builds CLN form ElementsProject/lightning and the grpc plugin from daywalker90/lightning#hodlvoice GitHub repositories . Any other docker image will not work.

Quoting @daywalker90 in #593

If an invoice is close to expiry (60s before) the htlcs will all be returned to the sender and the invoice will have the Hodlstate Canceled and the regular invoice lookup with cln will be UNPAID and shortly after EXPIRED.
This is probably also the biggest difference in behaviour to the lnd hodl-invoices, which is why we had to put a big expiry on all hodl-invoices in robosats.

Checklist before merging

  • Install pre-commit and initialize it: pip install pre-commit, then pre-commit install. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.

Reckless-Satoshi and others added 30 commits May 22, 2023 04:11
* Add cln service

* Add hodlvoice Dockerfile and entrypoint
* Add LNNode vendor switch
@Reckless-Satoshi
Copy link
Collaborator Author

Hey @daywalker90 , It seems we have 2 undefined failure_reason in line 470 and 475 . I have been checking but not sure how to assign them the right value. These are supposed to be strings from those in payment_failure_context . What would be the appropriate fix here?

@daywalker90
Copy link
Contributor

hmm there is no specific failure reason to give. So for 470 its just "Pending" and 475 "Failed" (and not pending!)

@daywalker90
Copy link
Contributor

btw in practice i've never seen it return with a non-error "pending" i wouldn't even know when this can happen

@Reckless-Satoshi
Copy link
Collaborator Author

btw in practice i've never seen it return with a non-error "pending" i wouldn't even know when this can happen

In lnd.py I see these if conditions just have a pass. Of course, it keeps cycling in the for loop until a return is reached.

I added a commit defining these two failure_reasons with their closest match. These will be directly returned to the client with the response to a request to claim rewards from the robot profile. If this sounds good to you, I will proceed and merge into main.

@daywalker90
Copy link
Contributor

yes looks good.

@Reckless-Satoshi Reckless-Satoshi merged commit 5ff70bc into main May 22, 2023
@Reckless-Satoshi Reckless-Satoshi deleted the add-cln-hodl-backend branch May 22, 2023 14:56
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.

Add core-lightning as LN node provider.
2 participants