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

Function plugin_hook_call_next

lightningd/plugin_hook.c:333–368  ·  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

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