mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
doc: add the new init and getmanifest fields
This commit is contained in:
parent
307fb0708e
commit
dda154612c
@ -85,7 +85,8 @@ this example:
|
||||
"hooks": [
|
||||
"openchannel",
|
||||
"htlc_accepted"
|
||||
]
|
||||
],
|
||||
"dynamic": true
|
||||
}
|
||||
```
|
||||
|
||||
@ -102,6 +103,10 @@ are mandatory, while the `long_description` can be omitted (it'll be
|
||||
set to `description` if it was not provided). `usage` should surround optional
|
||||
parameter names in `[]`.
|
||||
|
||||
The `dynamic` indicates if the plugin can be managed after `lightningd`
|
||||
has been started. Critical plugins that should not be stop should set it
|
||||
to false.
|
||||
|
||||
Plugins are free to register any `name` for their `rpcmethod` as long
|
||||
as the name was not previously registered. This includes both built-in
|
||||
methods, such as `help` and `getinfo`, as well as methods registered
|
||||
@ -122,7 +127,8 @@ simple JSON object containing the options:
|
||||
},
|
||||
"configuration": {
|
||||
"lightning-dir": "/home/user/.lightning",
|
||||
"rpc-file": "lightning-rpc"
|
||||
"rpc-file": "lightning-rpc",
|
||||
"startup": true
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -132,6 +138,9 @@ arbitrary and will currently be discarded by `lightningd`. JSON-RPC
|
||||
commands were chosen over notifications in order not to force plugins
|
||||
to implement notifications which are not that well supported.
|
||||
|
||||
The `startup` field allows a plugin to detect if it was started at
|
||||
`lightningd` startup (true), or at runtime (false).
|
||||
|
||||
## JSON-RPC passthrough
|
||||
|
||||
Plugins may register their own JSON-RPC methods that are exposed
|
||||
|
@ -69,6 +69,7 @@ void plugin_register(struct plugins *plugins, const char* path TAKES)
|
||||
p->configured = false;
|
||||
p->js_arr = tal_arr(p, struct json_stream *, 0);
|
||||
p->used = 0;
|
||||
p->signal_startup = false;
|
||||
|
||||
p->log = new_log(p, plugins->log_book, "plugin-%s",
|
||||
path_basename(tmpctx, p->cmd));
|
||||
@ -808,8 +809,10 @@ static void plugin_manifest_cb(const char *buffer,
|
||||
}
|
||||
|
||||
dynamictok = json_get_member(buffer, resulttok, "dynamic");
|
||||
if (dynamictok && json_to_bool(buffer, dynamictok, &dynamic_plugin))
|
||||
if (dynamictok && json_to_bool(buffer, dynamictok, &dynamic_plugin)) {
|
||||
plugin->signal_startup = true;
|
||||
plugin->dynamic = dynamic_plugin;
|
||||
}
|
||||
|
||||
if (!plugin_opts_add(plugin, buffer, resulttok) ||
|
||||
!plugin_rpcmethods_add(plugin, buffer, resulttok) ||
|
||||
|
@ -23,6 +23,7 @@ struct plugin {
|
||||
bool configured;
|
||||
/* If this plugin can be restarted without restarting lightningd */
|
||||
bool dynamic;
|
||||
bool signal_startup;
|
||||
|
||||
/* Stuff we read */
|
||||
char *buffer;
|
||||
|
Loading…
Reference in New Issue
Block a user