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

Function plugin_terminated_fail_req

lightningd/plugin.c:224–248  ·  view source on GitHub ↗

We act as if the plugin itself said "I'm dead!" */

Source from the content-addressed store, hash-verified

222
223/* We act as if the plugin itself said "I'm dead!" */
224static void plugin_terminated_fail_req(struct plugin *plugin,
225 struct jsonrpc_request *req)
226{
227 jsmntok_t *toks = toks_alloc(plugin);
228 const jsmntok_t *idtok;
229 const char *buf;
230 jsmn_parser parser;
231 bool complete;
232
233 buf = tal_fmt(plugin,
234 "{\"jsonrpc\": \"2.0\","
235 "\"id\": %s,"
236 "\"error\":"
237 " {\"code\":%i, \"message\":\"%s\"}"
238 "}\n\n",
239 req->id,
240 PLUGIN_TERMINATED,
241 "Plugin terminated before replying to RPC call.");
242 jsmn_init(&parser);
243 if (!json_parse_input(&parser, &toks, buf, strlen(buf), &complete))
244 abort();
245 assert(complete);
246 idtok = json_get_member(buf, toks, "id");
247 plugin_response_handle(plugin, buf, toks, idtok);
248}
249
250static void destroy_plugin(struct plugin *p)
251{

Callers 1

destroy_pluginFunction · 0.85

Calls 5

toks_allocFunction · 0.85
json_parse_inputFunction · 0.85
abortFunction · 0.85
json_get_memberFunction · 0.85
plugin_response_handleFunction · 0.85

Tested by

no test coverage detected