[c-lightning] adding new commands to lightning-cli

ZmnSCPxj ZmnSCPxj at protonmail.com
Fri Dec 7 18:20:29 AEDT 2018

Good morning Sarat,

What are you querying on the database?
If you find it useful, it might be that others find it useful, so it is best if you feed it back to us upstream what extra command you made.
It might also be possible, as cdecker said, that, extra command can be built from existing commands, and so it is better to put in some plugin instead.


Sent with [ProtonMail](https://protonmail.com) Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, December 7, 2018 2:30 PM, Sarat G <sarath.ginjupalli89 at gmail.com> wrote:

> Hi Christian,
> Thank you very much for the help, now I'm able to add the commands successfully by registering it with AUTODATA. Since I'm running the customised queries on the database now I'm registering my methods with AUTODATA and doing.
> Prior to this, I'm opening the `lightningd.sqlite3` file from the program. But the problem which I encountered is if I make an RPC call the DB gets locked and that sometimes preventing me to access the DB directly from the same process.
> Anyways I written few queries and registered them with AUTODATA and there are working fine.
> Thank you once again.
> Regards,
> Sarat G
> On Thu, Dec 6, 2018 at 7:50 PM Christian Decker <decker.christian at gmail.com> wrote:
>> Hi Sarat,
>> `AUTODATA` will take care of registering the json command with the
>> JSON-RPC framework and you should be able to see your command with
>> `lightning-cli help` after recompiling and restarting. The `struct
>> json_command` that you registered with `AUTODATA` contains the method
>> name and the function to be called when a request matching that method
>> name comes in. The compiler should be able to help you with the
>> signature of the function that we expect.
>> Notice that if the information you require is exposed in some other way,
>> you can also write a plugin, instead. Plugins can be written in whatever
>> language you want, and can register options and JSON-RPC methods as well
>> (more to come in future). So if you don't need information that is not
>> otherwise exposed that might be a good option (you'd need to run the
>> unreleased `master` version though).
>> Cheers,
>> Christian
>> Sarat G <sarath.ginjupalli89 at gmail.com> writes:
>>> Hi,
>>> As part of my project requirement, i got to need the command that returns
>>> the status of the channel by taking input as peer id. For that I written up
>>> the necessary logic and lined it using AUTODATA. My doubt is on the
>>> lightningd side at which part do I need to add the logic to process the
>>> command information sent by the lightning-cli.
>>> Can someone please provide me some insights into adding a single command to
>>> the lightning-cli repo.
>>> Thanks in advance.
>>> Regards,
>>> Sarat G
>>> --
>>> c-lightning mailing list
>>> c-lightning at lists.ozlabs.org
>>> https://lists.ozlabs.org/listinfo/c-lightning
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/c-lightning/attachments/20181207/fc7f327c/attachment.html>

More information about the c-lightning mailing list