From 49e7dcd4f226d2e4e32d07247b19b1747d439c79 Mon Sep 17 00:00:00 2001 From: Lagrang3 Date: Thu, 31 Oct 2024 12:50:19 +0100 Subject: [PATCH] lightningd: fix rpc_command hook When trying to subscribe renepay to an rpc_command hook I noticed the initialization of the plugins will time out. It seems that at initialization we have a recursive hook call that keeps lightningd hooked to synchronous communication with the subscriber. By letting hooks apply on after plugin startup the problem is fixed. Changelog-Fixed: lightningd: fixes rpc_command hooks causing a infinite io loop at plugin initialization Signed-off-by: Lagrang3 --- lightningd/plugin_hook.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightningd/plugin_hook.c b/lightningd/plugin_hook.c index 0fc25278f4e4..ec54f2aeaf06 100644 --- a/lightningd/plugin_hook.c +++ b/lightningd/plugin_hook.c @@ -217,7 +217,7 @@ bool plugin_hook_call_(struct lightningd *ld, const struct plugin_hook *hook, const char *cmd_id TAKES, tal_t *cb_arg STEALS) { - if (tal_count(hook->hooks)) { + if (tal_count(hook->hooks) && !ld->plugins->startup) { /* If we have a plugin that has registered for this * hook, serialize and call it */ /* FIXME: technically this is a leak, but we don't