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

Function plugin_notify_handle

lightningd/plugin.c:433–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433static const char *plugin_notify_handle(struct plugin *plugin,
434 const jsmntok_t *methodtok,
435 const jsmntok_t *paramstok)
436{
437 const jsmntok_t *idtok;
438 struct jsonrpc_request *request;
439
440 /* id inside params tells us which id to redirect to. */
441 idtok = json_get_member(plugin->buffer, paramstok, "id");
442 if (!idtok) {
443 return tal_fmt(plugin,
444 "JSON-RPC notify \"id\"-field is not present");
445 }
446
447 request = strmap_getn(&plugin->plugins->pending_requests,
448 plugin->buffer + idtok->start,
449 idtok->end - idtok->start);
450 if (!request) {
451 return tal_fmt(
452 plugin,
453 "Received a JSON-RPC notify for non-existent request");
454 }
455
456 /* Ignore if they don't have a callback */
457 if (request->notify_cb)
458 request->notify_cb(plugin->buffer, methodtok, paramstok, idtok,
459 request->response_cb_arg);
460 return NULL;
461}
462
463/* Check if the plugin is allowed to send a notification of the
464 * specified topic, i.e., whether the plugin has announced the topic

Callers 1

Calls 1

json_get_memberFunction · 0.50

Tested by

no test coverage detected