Skip to content

Commit f95b542

Browse files
committed
plugins: no longer accept 0/1 for boolean options.
Signed-off-by: Rusty Russell <[email protected]> Changelog-Removed: allowing 0/1 instead of false/true for plugin options (deprecated v23.08, disabled by default in v24.11).
1 parent c1c93a3 commit f95b542

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

doc/developers-guide/deprecations.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ hidden: false
1111
| rest-protocol.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-protocol` to `clnrest-protocol` (added in v23.11) |
1212
| rest-host.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-host` to `clnrest-host` (added in v23.11) |
1313
| rest-certs.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-certs` to `clnrest-certs` (added in v23.11) |
14-
| ....0-or-1 | Config | v23.08 | v24.08 | Boolean options (in plugins only) used to accept `0` or `1` in place of `true` or `false` |
1514
| options.flag.default-not-false | Getmanifest Reply | v23.08 | v24.08 | `flag` options with a default which is not `false` (would be meaningless, since user can only set it to `true` |
1615
| plugin.nonumericids | Getmanifest Reply | v23.08 | v24.08 | Plugins must specify that they can accept non-numeric command ids (numeric ids are deprecated) |
1716
| listchannels.include_private | Field(s) | v24.02 | v24.08 | `listchannels` including private channels (now use listpeerchannels which gives far more detail) |

lightningd/plugin.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -953,20 +953,11 @@ static char *plugin_opt_long_check(const char *arg, struct plugin_opt *popt)
953953

954954
static char *plugin_opt_bool_check(const char *arg, struct plugin_opt *popt)
955955
{
956-
/* FIXME: For some reason, '1' and '0' were allowed here? */
957-
if (streq(arg, "1") || streq(arg, "0")) {
958-
struct lightningd *ld = popt->plugin->plugins->ld;
959-
if (!lightningd_deprecated_in_ok(ld, ld->log, ld->deprecated_ok,
960-
popt->name + 2, "0-or-1",
961-
"v23.08", "v24.08", NULL)) {
962-
return "boolean plugin arguments must be true or false";
963-
}
964-
} else {
965-
bool v;
966-
char *ret = opt_set_bool_arg(arg, &v);
967-
if (ret)
968-
return ret;
969-
}
956+
bool v;
957+
char *ret = opt_set_bool_arg(arg, &v);
958+
if (ret)
959+
return ret;
960+
970961
return plugin_opt_check(popt);
971962
}
972963

tests/test_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_option_types(node_factory):
138138
# the node should fail after start, and we get a stderr msg
139139
n.daemon.start(wait_for_initialized=False, stderr_redir=True)
140140
assert n.daemon.wait() == 1
141-
assert n.daemon.is_in_stderr("--bool_opt=1: boolean plugin arguments must be true or false")
141+
assert n.daemon.is_in_stderr("--bool_opt=1: Invalid argument '1'")
142142

143143
# Flag opts shouldn't allow any input
144144
n = node_factory.get_node(options={

0 commit comments

Comments
 (0)