Browse Source

doc: fix up documentation about when we move into lightning-dir.

And make sure that plugins know that they should not touch things
until their init call.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
pull/2938/head
Rusty Russell 5 years ago
committed by ZmnSCPxj, ZmnSCPxj jxPCSmnZ
parent
commit
202ab91234
  1. 5
      doc/PLUGINS.md
  2. 12
      lightningd/lightningd.c

5
doc/PLUGINS.md

@ -41,7 +41,10 @@ will read replies from its `stdout`. To initialize the plugin two RPC
methods are required: methods are required:
- `getmanifest` asks the plugin for command line options and JSON-RPC - `getmanifest` asks the plugin for command line options and JSON-RPC
commands that should be passed through commands that should be passed through. Note that can be run before
`lightningd` checks that it is the sole user of the `lightning-dir`
directory (for `--help`) so your plugin should not touch files at this
point).
- `init` is called after the command line options have been - `init` is called after the command line options have been
parsed and passes them through with the real values (if specified). This is also parsed and passes them through with the real values (if specified). This is also
the signal that `lightningd`'s JSON-RPC over Unix Socket is now up the signal that `lightningd`'s JSON-RPC over Unix Socket is now up

12
lightningd/lightningd.c

@ -665,11 +665,11 @@ int main(int argc, char *argv[])
if (!ld->daemon_dir) if (!ld->daemon_dir)
errx(1, "Could not find daemons"); errx(1, "Could not find daemons");
/*~ Handle early options, but don't move to --lightning-dir /*~ Handle early options; this moves us into --lightning-dir.
* just yet. Plugins may add new options, which is why we are * Plugins may add new options, which is why we are splitting
* splitting between early args (including --plugin * between early args (including --plugin registration) and
* registration) and non-early opts. This also forks if they * non-early opts. This also forks if they say
* say --daemonize. */ * --daemonize. */
handle_early_opts(ld, argc, argv); handle_early_opts(ld, argc, argv);
/*~ Initialize all the plugins we just registered, so they can /*~ Initialize all the plugins we just registered, so they can
@ -677,7 +677,7 @@ int main(int argc, char *argv[])
* options registration). */ * options registration). */
plugins_init(ld->plugins, ld->dev_debug_subprocess); plugins_init(ld->plugins, ld->dev_debug_subprocess);
/*~ Handle options and config; move to .lightningd (--lightning-dir) */ /*~ Handle options and config. */
handle_opts(ld, argc, argv); handle_opts(ld, argc, argv);
/*~ Now create the PID file: this errors out if there's already a /*~ Now create the PID file: this errors out if there's already a

Loading…
Cancel
Save