LN #18 - BOLT#11, clangd and renepay
In the live coding session of next week (Thursday) we are going to look at the implementation of BOLT #11 invoices in Core Lightning source code.
I think we are going to have some fun. If you are interested soon you'll find more information about the event at:
https://community.corelightning.org/c/events/
Last Tuesday I set up my text editor to work with the CLN code base written in C. Specifically I wanted code completion and jump-to-definition functionalities. To have them I used clangd language server. Let me describe the step I followed in case you want to use it in your editor/IDE.
First, I installed clang and clangd by running the following command (I'm on Ubuntu 22.04.2 LTS):
$ sudo apt install clang-15 clangd-15
$ sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100
$ sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-15 100
Then I set the LSP (language server protocol) client of my editor (eglot in my case on Emacs). In the install page of clangd there are instructions for other editors.
To help clangd understand CLN source code, I generated the file compile_commands.json at the top of CLN repository which contains compile commands for every source file in a project.
To do so I used bear utility after running ./configure script like this:
BOOM! Ready to hack on Core Lightning!
Links:
- https://twitter.com/tonyaldon/status/1724478753005248588
- https://clang.llvm.org
- https://clangd.llvm.org
- https://clangd.llvm.org/installation
- https://github.com/rizsotto/Bear
In CLN 23.08, the renepay plugin has been added. It adds renepay command which implements Rene's minimum cost flow proposals in a concrete form.
Eduardo Quintana who implemented this plugin wrote 2 articles about it that you may find interesting:
- Renepay I: Linearization of the Cost Function,
- Renepay II Combining Fees and Uncertainty Cost (part 1).
This plugin is still experimental.
Rene Pickardt and Stefan Richter are currently reviewing renepay plugin on Github. I think there will be some interesting conversations there! Here are the corresponding issues where the conversation with Eduardo Quintana has already started:
- https://github.com/ElementsProject/lightning/issues/6846
- https://github.com/ElementsProject/lightning/issues/6852
Maybe you also want to check the pickhardtpayments repository which implements collection of classes and interfaces that help with testing and implementation of Pickhardt Payments:
https://github.com/renepickhardt/pickhardtpayments
That's it for today, I hope you're doing well, see you next time.