MCPcopy Create free account
hub / github.com/ElementsProject/lightning / plugin_dynamic_start

Function plugin_dynamic_start

lightningd/plugin_control.c:65–85  ·  view source on GitHub ↗

* Called when trying to start a plugin through RPC, it starts the plugin and * will give a result 60 seconds later at the most (once init completes). */

Source from the content-addressed store, hash-verified

63 * will give a result 60 seconds later at the most (once init completes).
64 */
65static struct command_result *
66plugin_dynamic_start(struct plugin_command *pcmd, const char *plugin_path,
67 const char *buffer, const jsmntok_t *params)
68{
69 struct plugin *p = plugin_register(pcmd->cmd->ld->plugins, plugin_path, pcmd, false, buffer, params);
70 const char *err;
71
72 if (!p)
73 return command_fail(pcmd->cmd, JSONRPC2_INVALID_PARAMS,
74 "%s: %s", plugin_path,
75 errno ? strerror(errno) : "already registered");
76
77 /* This will come back via plugin_cmd_killed or plugin_cmd_succeeded */
78 err = plugin_send_getmanifest(p, pcmd->cmd->id);
79 if (err)
80 return command_fail(pcmd->cmd, PLUGIN_ERROR,
81 "%s: %s",
82 plugin_path, err);
83
84 return command_still_pending(pcmd->cmd);
85}
86
87/**
88 * Called when trying to start a plugin directory through RPC, it registers

Callers 1

json_plugin_controlFunction · 0.85

Calls 4

plugin_registerFunction · 0.85
plugin_send_getmanifestFunction · 0.85
command_failFunction · 0.70
command_still_pendingFunction · 0.70

Tested by

no test coverage detected