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

Bug: balances for Core Lightning nodes are not updated correctly sometimes #575

Open
ktecho opened this issue Jul 29, 2022 · 6 comments
Open
Labels
bug Something isn't working up for grabs Anyone can work on this

Comments

@ktecho
Copy link
Contributor

ktecho commented Jul 29, 2022

Describe the bug
Sometimes, after paying an invoice, the balance of the channel is not updated correctly, and the colors of the the lines in the channel are wrong too. This happens afaik only for Core Lightning nodes.

To Reproduce

  1. Git clone Polar from master (it fails also for v1.3.0 AppImage)
  2. Open Polar (yarn ; yarn package; ./dist/polar-linux-x86_64-v1.3.0.AppImage).
  3. Create a network with 3 Core-Lightning nodes
  4. Link each node with the next one using "create channel" option. So Alice to Bob, Bot to Carol. Default options in the dialog.
  5. Create an invoice in the last node (Carol). 150.000 sats.
  6. Pay the invoice from the first node (Alice).
  7. Sometimes (not always), balance information is not correct (see screenshot below).

Expected behavior
Information and graphs about channels and balances must be accurate.

Screenshots
So for the first channel, it seems like it didn't paid the invoice:

image

The second channel is fine. It got the correct information:

image

The graph also showns the wrong balance:

image

Desktop (please complete the following information):

  • OS: Kubuntu 22.04
  • Polar Version: master (2022-07-29). It also fails for v1.3.0

I'll tell what I found about this in next message.

@ktecho ktecho added the bug Something isn't working label Jul 29, 2022
@ktecho
Copy link
Contributor Author

ktecho commented Jul 29, 2022

What I've found after investigating the issue, is that after paying the invoice, channel/listChannels is done too soon for the first node, so the balance is not updated yet. For the rest of the nodes, the channel/listChannels is done later, so it's always correct.

I've seen this duplicating the channel/listChannels call that's done in getChannels() in clightningService.ts, so the first call has the wrong balance, but the second one done 100 ms later has the correct information.

I've been trying to use some calls to get the information about it the last payment is fully done or is still being made. I asked some Blockstream employees and they gave me some hints, but:

1- They told me to waitsendpay, but the function seems like it's missing from the RTL REST API.
2- They also told me to do peer/listpeers to check that there are not HTLCs in flight, but the peer/listpeers call in RTL does not return all the required fields.

Do you have any recommendation on what we could do? Thanks!

@jamaljsr
Copy link
Owner

I've ran into this issue before as well. The manual workaround is to just hit the refresh button in the sidebar, but it would be better to try to fix it.

Since RTL doesn't currently support the API's that we need, the best course of action would be to open a PR in the RTL repo to add them. I've done this in the past when I needed additional data for Polar. Also, I'm sure they would appreciate the updates.

@ktecho
Copy link
Contributor Author

ktecho commented Aug 4, 2022

I could add the methods in RTL, but having into account that the docker images are already generated and will have the old RTL, could we regenerate all the Core Lightning docker images so they contain the latest RTL API?

@jamaljsr
Copy link
Owner

jamaljsr commented Aug 4, 2022

Yes, I can rebuild and push new images to DockerHub with the updated RTL.

@ktecho
Copy link
Contributor Author

ktecho commented Aug 4, 2022

Cool! I could give it a look next week if children left some free energy in me... :)

@jamaljsr
Copy link
Owner

jamaljsr commented Aug 4, 2022

lol.. i know the feeling as well. Good luck 😁

@jamaljsr jamaljsr added the up for grabs Anyone can work on this label Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working up for grabs Anyone can work on this
Projects
None yet
Development

No branches or pull requests

2 participants