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>
This commit is contained in:
Rusty Russell 2019-08-06 13:37:40 +09:30 committed by ZmnSCPxj, ZmnSCPxj jxPCSmnZ
parent 118150227e
commit 202ab91234
2 changed files with 10 additions and 7 deletions

View File

@ -41,7 +41,10 @@ will read replies from its `stdout`. To initialize the plugin two RPC
methods are required:
- `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
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

View File

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