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

Function plugin_dynamic_start

lightningd/plugin_control.c:64–87  ·  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

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