[c-lightning] plugin development

Richard Bondi socketexception at gmail.com
Sat Dec 8 13:55:40 AEDT 2018

I have a couple of issues.  I finally got a plugin to load without
error, and show as an option when running the help command from the
cli.  It is basically a port of the hello plugin in c#(also tried in
go, but will detail later)

When I call the plugin it just hangs.  I have tried just ignoring all
input and returning the same response as the init and getmanifest,
still hangs.  It seems the passthrough is taking place, if I put in a
command like

cli/lightning-cli hello {"greeting":"fred"}

I get a response

Invalid token in json input: '{ "method" : "hello", "id" :
"lightning-cli-25109", "params" : [ {greeting:fred}] }'

which make sense, if I do an echo passing the same json I get the broken json

what I expect to happen is, when I type in

cli/lightning-cli hello fred

note I also tried varying versions of fred in qoutes, ie. echo
"\"fred\"" yields "fred" in the output

I expect my message with "fred" substituted in or I expect the command
that I look for in code to be

{ "method" : "hello", "id" : "lightning-cli-25109", "params" : ["fred"] }

where are my assumptions wrong?


The other issue is when I try to do in go, it seems to call
`plugin_read_json_one` more than once for the same plugin's
getmanifest and I get the "Received a JSON-RPC response for
non-existent request" error.  It seems to have the same buffer value,
but no request.  I have gone as far in my code to remove getmanifest
from the map so there is no way it could erroneously send the request
a second time.  I hope maybe this can be helpful information, but I am
totally baffled on this on and hope also maybe someone has ideas as to
what the problem may be here.

More information about the c-lightning mailing list