Closed rsbondi closed 5 years ago
But I question the implementation in clightning. If a plugin is loaded via the plugin command, would it not make sense to set the dynamic flag at that time? Or if dynamic is not set, then it should not be allowed to be loaded via the plugin command? Maybe I should open an issue there?
Yes it would. However the manifest is generated plugin-side, I don't know if it's a good design to modify it lightningd
-side. Since this issue is on the glightning repo I suggest you just amend the manifest generation here as you did in #13 :-).
You can anyway open an issue on the C-lightning repo, I'd be happy to quickly implement it (shouldn't be more than a couple of line to add) and discuss it with other contributors on a PR.
EDIT: I reviewed the code and found the rationale for this decision (but you at least made me found a 'bug' :-)). Actually the startup check is done only for the stop
subcommand. A dynamically-started plugin might not want to be stopped and lightningd
should not force the dynamic
boolean to be set.
Well this is unreleased, so I think I will take the discussion there.
I edited my above comment. ping @rsbondi
Ok, that makes sense, but not sure if I would call it a bug, maybe it is ok to start any plugin dynamically, but not allow to stop, anyway, reopening
but not sure if I would call it a bug
What I called a 'bug' (between quotes) was that I noticed unused code while reading it, not related to this issue but it made me find it.
Anyway to address your concern you should add the field at manifest creation in glightning. It seems to be located here : https://github.com/niftynei/glightning/blob/7dc7d2d4d5b7aabd49d7ebfdcc7cb7b6e886aed6/glightning/plugin.go#L443-L445
ACK. Correct, you can't unload a plugin that hasn't marked itself as dynamic. As of right now, glightning currently does not support marking a plugin as dynamic.
If not already, it's probably worthwhile to make the relationship between dynamic and unloading more clear in the PLUGINS doc on c-lightning.
I was actually thinking lightning-plugin
needs more clarification, I think PLUGINS
is fine. I ran into this from more of a user's perspective, not clear on what was supposed to happen or why.
Steps:
The plugin starts fine but calling
lightning-cli plugin stop path/to/myplugin
gives error
path/to/myplugin plugin cannot be managed when lightningd is up
I notice the
dynamic
flag has been added in thegetmanifest
call in the plugin docs of clightning. It should be added here, as currently implementation in clightning.But I question the implementation in clightning. If a plugin is loaded via the
plugin
command, would it not make sense to set thedynamic
flag at that time? Or ifdynamic
is not set, then it should not be allowed to be loaded via theplugin
command? Maybe I should open an issue there?cc @darosior