-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Core Lightning: CLNRest backend #2228
Conversation
460d7ca
to
4088cc6
Compare
Fixed and rebased |
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.
Ok looks like that you arrive before me, I left some comments because in this way I can build on top of you
@@ -1347,6 +1357,75 @@ export default class NodeConfiguration extends React.Component< | |||
)} | |||
</> | |||
)} | |||
{implementation === 'cln-rest' && ( |
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 not use the same of c-lightning-REST? at the end of the day the UI is the same
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.
Because cln-rest uses runes and the old one uses a macaroon. We can just delete the old when Zeus wants to depracate it completely. Right now both are supported.
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.
Because cln-rest uses runes and the old one uses a macaroon.
are the same things a the concept level, you can just replace the string with implementation === 'cln-rest' ? "rune" : "macaroon"
no?
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 just find them cleaner to be separate because old c-lightning-rest is sharing with LND anyway. Whatever Evan wants.
you are too fast 😵💫 anyway, this is probably a good opportunity to fix |
Thank you for catching that. I think your code is missing tag == |
I get this error when trying send onchain in signet via CLNRest (via this PR) "unknown parameter: address, this may be caused by I checked to make sure I had not issue with withdraw on my node via CLI. |
i don't see this tags (at least under |
Yeah, that's the problem, it doesn't put it under wallet. Have to figure out where it does. In the examples in the docs, it puts it under some long string account. Have to see what that is. |
it's channel id according to the cln documentation:
i'm not sure these events are relevant if you want only the on-chain transactions. |
I agree. CLNs APIs don't seem to allow pagination as well which is annoying. Maybe someone can test with their mainnet node which is old and see how it performs. |
yep, not the best api i've come across 🤷♂️ another mitigation could be somehow to make only one query for EDIT: and i would do that myself, but it won't get me the bounty probably haha 🥲 |
From what testing I have been able to do, I believe activity view needs some love. It might be helpful to start with what transactions should be included in this view. I'm not sure if this is documented somewhere (like a previous zeus GitHub issue/PR/etc). What I expect to be listed in the activity view is:
I don't expect to see channel open / close transactions but I also don't mind if they are in this view if it's communicated that they are part of an open/close channel transaction. Right now I see multiple rows in the activity view for a single on chain payments. I have a hard time dissecting what information bkpr-listaccountevents is returning. Sorry this comment is not more helpful. I just wanted to provide feedback on what I have tested so far with this PR. Thank you for this work. |
This sounds good to me except expired and unpaid invoices, that could be a bit too much specially expired. |
Here is an example of 40,000 sat onchain spend (https://mutinynet.com/tx/99a918361919956cc76801b6014e233d834466dbb25b4f031825e1eb60b972e8) that shows 3 rows in the activity view for a single spend transaction. The 40,000 sat row appears first as soon as I complete the spend (while the tx is in the mempool). This shows as a credit but is actually a debit. Then once the transaction is confirmed into 1+ blocks, 2 more rows appear. A debit of the utxo I used to make the spend and then a credit of the change back to my wallet. |
Ok, yeah this needs to be fixed. Only the spend should show up, not the utxos spent and change received. |
i agree, and it's also solve the potential performance issue, as you can request only |
ok @newtonick can you test now? I think it should be fixed. Note that if a channel closes, you will see an onchain payment because you're getting your money back. @sha-265 unfortunately i think we can't get around the performance issue without compromising accuracy of the info because CLN displays change outputs as deposits and its really difficult to figure out if its a real deposit or a change output from like channel opens without checking channel opens from events. I asked in the CLN group if there is an easy way to check if an address is ours in CLN so that we can easily filter out change, let's see. |
i don't understand how tons of irrelevant events solving this, but at least you should get the same data only once and not three different times. |
I don't understand what you mean? I am getting only once. |
look here: Lines 165 to 168 in e89187c
i think if you are using |
Ah, that's old code. I never touched that. Will look into it. |
I finally got the clnrest plugin to work (Python environments are a pain...). Happy to test all this when there's a testflight build. |
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.
tACK
All things looking good. Congrats, @niteshbalusu11 you will be receiving the bounty.
We are expecting you to help address any issues that may arise during alpha and beta testing - not expecting anything major as we've already done some extensive testing
Just tested the https://github.com/ZeusLN/zeus/releases/tag/v0.9.0-beta1 release on iOs. It manages to connect! I can seen my utxos on the coins screen. I can see my channels. I can create an invoice to receive. The screen doesn't update when the invoice is paid, but afaik it didn't do that with c-lightning-rest either. The Activity tab still crashes as it did with c-lightning-rest. The combination of the above two things means I can't see if a payment to me succeeded. I can pay a regular bolt11 invoice. |
@Sjors is your node really old with a lot of data? |
@niteshbalusu11 the node is very old, but it does run the latest v24.05. It has 10K+ transactions, mostly keysends from podcasting 2.0 listeners. I guess it's tripping over missing field in older transactions? |
It could also be that the response from the 10k+ txns could be very large because the RPC call right now has no way limit the records returned. Working on figuring that part out. |
This might fix some issues. |
I don't know how, but it's working for me with older version |
More recently this usually does work.
This is fixed since. |
Description
Relates to issue: #1637
Depracates c-lightning-rest and adds a new backend using core-lightning team maintained CLN Rest.
Important Note: Minimum core-lightning version to use this is
v24.02
due to breaking changes from cln team.This PR should cover all features which the old backend was covering.
I have not tested this on iOS coz I wasn't able to get xcode to build zeus.
This pull request is categorized as a:
Checklist
yarn run tsc
and made sure my code compiles correctlyyarn run lint
and made sure my code didn’t contain any problematic patternsyarn run prettier
and made sure my code is formatted correctlyyarn run test
and made sure all of the tests passTesting
If you modified or added a utility file, did you add new unit tests?
I have tested this PR on the following platforms (please specify OS version and phone model/VM):