lightningd: actually order the hooks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2020-10-30 11:43:42 +10:30
committed by neil saitug
parent e2a31f42f2
commit 6a55b4367e
3 changed files with 132 additions and 1 deletions

View File

@@ -1064,7 +1064,7 @@ static const char *plugin_hooks_add(struct plugin *plugin, const char *buffer,
return NULL;
json_for_each_arr(i, t, hookstok) {
char *name;
char *name, *depfail;
struct plugin_hook *hook;
if (t->type == JSMN_OBJECT) {
@@ -1093,6 +1093,12 @@ static const char *plugin_hooks_add(struct plugin *plugin, const char *buffer,
}
plugin_hook_add_deps(hook, plugin, buffer, beforetok, aftertok);
depfail = plugin_hook_make_ordered(tmpctx, hook);
if (depfail)
return tal_fmt(plugin,
"Cannot correctly order hook %s:"
"conflicts in %s",
name, depfail);
tal_free(name);
}
return NULL;