From 0c1d19b4c8ec4730a969551806224399faf0bae7 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 29 Oct 2020 11:10:16 +1030 Subject: [PATCH] plugins: deprecate old form of hooks. Now both python and c libraries are updated, we can officially deprecate the old form. Signed-off-by: Rusty Russell Changelog-Deprecated: plugins: hooks should now be specified using objects, not raw names. --- lightningd/plugin.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 7c08b66839ce..028f0d0fc450 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -1078,9 +1078,12 @@ static const char *plugin_hooks_add(struct plugin *plugin, const char *buffer, name = json_strdup(tmpctx, buffer, nametok); beforetok = json_get_member(buffer, t, "before"); aftertok = json_get_member(buffer, t, "after"); - } else { + } else if (deprecated_apis) { name = json_strdup(tmpctx, plugin->buffer, t); beforetok = aftertok = NULL; + } else { + return tal_fmt(plugin, + "hooks must be an array of objects"); } hook = plugin_hook_register(plugin, name);