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

Function plugin_notify_handle

lightningd/plugin.c:537–565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

535}
536
537static const char *plugin_notify_handle(struct plugin *plugin,
538 const char *buffer,
539 const jsmntok_t *methodtok,
540 const jsmntok_t *paramstok)
541{
542 const jsmntok_t *idtok;
543 struct jsonrpc_request *request;
544
545 /* id inside params tells us which id to redirect to. */
546 idtok = json_get_member(buffer, paramstok, "id");
547 if (!idtok) {
548 return tal_fmt(plugin,
549 "JSON-RPC notify \"id\"-field is not present");
550 }
551
552 /* Include any "" in id */
553 request = strmap_getn(&plugin->pending_requests,
554 json_tok_full(buffer, idtok),
555 json_tok_full_len(idtok));
556 if (!request) {
557 return NULL;
558 }
559
560 /* Ignore if they don't have a callback */
561 if (request->notify_cb)
562 request->notify_cb(buffer, methodtok, paramstok, idtok,
563 request->response_cb_arg);
564 return NULL;
565}
566
567/* Check if the plugin is allowed to send a notification of the
568 * specified topic, i.e., whether the plugin has announced the topic

Callers 1

Calls 3

json_get_memberFunction · 0.85
json_tok_fullFunction · 0.50
json_tok_full_lenFunction · 0.50

Tested by

no test coverage detected