From 1401275cb8af2f390979c547c1eefd4435e469ce Mon Sep 17 00:00:00 2001 From: Lagrang3 Date: Tue, 27 Aug 2024 21:58:41 +0100 Subject: [PATCH] lightningd: log if builtin plugin fails to start Lightningd should log if a builtin plugin fails to start instead of silently skip over it. Changelog-Add: log message if builtin plugin fails to start. Signed-off-by: Lagrang3 --- lightningd/plugin.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 1292b8914268..4dd58b918152 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -2536,14 +2536,19 @@ void plugins_set_builtin_plugins_dir(struct plugins *plugins, const char *dir) { /*~ Load the builtin plugins as important. */ - for (size_t i = 0; list_of_builtin_plugins[i]; ++i) - plugin_register(plugins, - take(path_join(NULL, dir, - list_of_builtin_plugins[i])), - NULL, - /* important = */ - !streq(list_of_builtin_plugins[i], "cln-renepay"), - NULL, NULL); + for (size_t i = 0; list_of_builtin_plugins[i]; ++i) { + struct plugin *p = plugin_register( + plugins, + take(path_join(NULL, dir, list_of_builtin_plugins[i])), + NULL, + /* important = */ + !streq(list_of_builtin_plugins[i], "cln-renepay"), NULL, + NULL); + if (!p) + log_unusual( + plugins->log, "failed to register plugin %s", + path_join(tmpctx, dir, list_of_builtin_plugins[i])); + } } void shutdown_plugins(struct lightningd *ld)