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

Function plugin_send_getmanifest

lightningd/plugin.c:1704–1742  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1702}
1703
1704const char *plugin_send_getmanifest(struct plugin *p, const char *cmd_id)
1705{
1706 char **cmd;
1707 int stdinfd, stdoutfd;
1708 struct jsonrpc_request *req;
1709 bool debug = false;
1710
1711#if DEVELOPER
1712 if (p->plugins->ld->dev_debug_subprocess
1713 && strends(p->cmd, p->plugins->ld->dev_debug_subprocess))
1714 debug = true;
1715#endif
1716 cmd = tal_arrz(tmpctx, char *, 2 + debug);
1717 cmd[0] = p->cmd;
1718 if (debug)
1719 cmd[1] = "--debugger";
1720 p->pid = pipecmdarr(&stdinfd, &stdoutfd, &pipecmd_preserve, cmd);
1721 if (p->pid == -1)
1722 return tal_fmt(p, "opening pipe: %s", strerror(errno));
1723
1724 log_debug(p->plugins->log, "started(%u) %s", p->pid, p->cmd);
1725 p->buffer = tal_arr(p, char, 64);
1726 jsmn_init(&p->parser);
1727 p->toks = toks_alloc(p);
1728
1729 /* Create two connections, one read-only on top of p->stdout, and one
1730 * write-only on p->stdin */
1731 p->stdout_conn = io_new_conn(p, stdoutfd, plugin_stdout_conn_init, p);
1732 p->stdin_conn = io_new_conn(p, stdinfd, plugin_stdin_conn_init, p);
1733 req = jsonrpc_request_start(p, "getmanifest", cmd_id, p->log,
1734 NULL, plugin_manifest_cb, p);
1735 json_add_bool(req->stream, "allow-deprecated-apis", deprecated_apis);
1736 jsonrpc_request_end(req);
1737 plugin_request_send(p, req);
1738 p->plugin_state = AWAITING_GETMANIFEST_RESPONSE;
1739
1740 plugin_set_timeout(p);
1741 return NULL;
1742}
1743
1744bool plugins_send_getmanifest(struct plugins *plugins, const char *cmd_id)
1745{

Callers 2

plugins_send_getmanifestFunction · 0.85
plugin_dynamic_startFunction · 0.85

Calls 7

strendsFunction · 0.85
pipecmdarrFunction · 0.85
plugin_set_timeoutFunction · 0.85
jsonrpc_request_endFunction · 0.70
plugin_request_sendFunction · 0.70
toks_allocFunction · 0.50
json_add_boolFunction · 0.50

Tested by

no test coverage detected