lightningd: don't simply ignore defaults on flags, deprecate.

Changelog-Deprecated: Plugins: `default` no longer accepted on `flag` type parameters (it was silently ignored, so just don't set it).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-06-02 12:06:04 +09:30
parent b9270c564a
commit 0df97547dd
3 changed files with 10 additions and 5 deletions

View File

@@ -973,8 +973,13 @@ static const char *plugin_opt_add(struct plugin *plugin, const char *buffer,
"%s type \"%s\" cannot have multi",
popt->name, popt->type);
/* We default flags to false, the default token is ignored */
if (json_tok_streq(buffer, typetok, "flag"))
if (json_tok_streq(buffer, typetok, "flag") && defaulttok) {
if (!deprecated_apis) {
return tal_fmt(plugin, "%s type flag cannot have default",
popt->name);
}
defaulttok = NULL;
}
} else {
return tal_fmt(plugin,
"Only \"string\", \"int\", \"bool\", and \"flag\" options are supported");