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

Function plugin_hook_call_next

lightningd/plugin_hook.c:344–379  ·  view source on GitHub ↗

Returns true if it finished all the hooks (and thus didn't call anything) */

Source from the content-addressed store, hash-verified

342
343/* Returns true if it finished all the hooks (and thus didn't call anything) */
344static bool plugin_hook_call_next(struct plugin_hook_request *ph_req)
345{
346 struct jsonrpc_request *req;
347 const struct plugin_hook *hook = ph_req->hook;
348 struct plugin *plugin;
349
350 /* Find next non-NULL hook: call final if we're done */
351 do {
352 ph_req->hook_index++;
353 if (ph_req->hook_index >= tal_count(hook->hooks)) {
354 hook_done(ph_req->ld, ph_req->hook, ph_req->cb_arg);
355 tal_free(ph_req);
356 return true;
357 }
358 } while (!hook_callable(hook->hooks[ph_req->hook_index],
359 ph_req->strfilterfield,
360 ph_req->intfilterfield));
361
362 plugin = hook->hooks[ph_req->hook_index]->plugin;
363 log_trace(ph_req->ld->log, "Calling %s hook of plugin %s",
364 ph_req->hook->name, plugin->shortname);
365 req = jsonrpc_request_start(NULL, hook->name, ph_req->cmd_id,
366 plugin_get_logger(plugin),
367 NULL,
368 plugin_hook_callback, ph_req);
369
370 hook->serialize_payload(ph_req->cb_arg, req->stream, plugin);
371 jsonrpc_request_end(req);
372
373 dev_save_plugin_io_out(plugin->plugins,
374 "hook_out", hook->name,
375 req->stream);
376
377 plugin_request_send(plugin, req);
378 return false;
379}
380
381bool plugin_hook_call_(struct lightningd *ld,
382 struct plugin_hook *hook,

Callers 2

plugin_hook_callbackFunction · 0.85
plugin_hook_call_Function · 0.85

Calls 7

hook_doneFunction · 0.85
tal_freeFunction · 0.85
hook_callableFunction · 0.85
plugin_get_loggerFunction · 0.85
dev_save_plugin_io_outFunction · 0.85
jsonrpc_request_endFunction · 0.70
plugin_request_sendFunction · 0.70

Tested by

no test coverage detected