mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
doc: add the new init and getmanifest fields
This commit is contained in:
@@ -85,7 +85,8 @@ this example:
|
|||||||
"hooks": [
|
"hooks": [
|
||||||
"openchannel",
|
"openchannel",
|
||||||
"htlc_accepted"
|
"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
|
set to `description` if it was not provided). `usage` should surround optional
|
||||||
parameter names in `[]`.
|
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
|
Plugins are free to register any `name` for their `rpcmethod` as long
|
||||||
as the name was not previously registered. This includes both built-in
|
as the name was not previously registered. This includes both built-in
|
||||||
methods, such as `help` and `getinfo`, as well as methods registered
|
methods, such as `help` and `getinfo`, as well as methods registered
|
||||||
@@ -122,7 +127,8 @@ simple JSON object containing the options:
|
|||||||
},
|
},
|
||||||
"configuration": {
|
"configuration": {
|
||||||
"lightning-dir": "/home/user/.lightning",
|
"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
|
commands were chosen over notifications in order not to force plugins
|
||||||
to implement notifications which are not that well supported.
|
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
|
## JSON-RPC passthrough
|
||||||
|
|
||||||
Plugins may register their own JSON-RPC methods that are exposed
|
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->configured = false;
|
||||||
p->js_arr = tal_arr(p, struct json_stream *, 0);
|
p->js_arr = tal_arr(p, struct json_stream *, 0);
|
||||||
p->used = 0;
|
p->used = 0;
|
||||||
|
p->signal_startup = false;
|
||||||
|
|
||||||
p->log = new_log(p, plugins->log_book, "plugin-%s",
|
p->log = new_log(p, plugins->log_book, "plugin-%s",
|
||||||
path_basename(tmpctx, p->cmd));
|
path_basename(tmpctx, p->cmd));
|
||||||
@@ -808,8 +809,10 @@ static void plugin_manifest_cb(const char *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
dynamictok = json_get_member(buffer, resulttok, "dynamic");
|
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;
|
plugin->dynamic = dynamic_plugin;
|
||||||
|
}
|
||||||
|
|
||||||
if (!plugin_opts_add(plugin, buffer, resulttok) ||
|
if (!plugin_opts_add(plugin, buffer, resulttok) ||
|
||||||
!plugin_rpcmethods_add(plugin, buffer, resulttok) ||
|
!plugin_rpcmethods_add(plugin, buffer, resulttok) ||
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ struct plugin {
|
|||||||
bool configured;
|
bool configured;
|
||||||
/* If this plugin can be restarted without restarting lightningd */
|
/* If this plugin can be restarted without restarting lightningd */
|
||||||
bool dynamic;
|
bool dynamic;
|
||||||
|
bool signal_startup;
|
||||||
|
|
||||||
/* Stuff we read */
|
/* Stuff we read */
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user