From 9bbb52097e3525d5c90949f41b1332ce355075a3 Mon Sep 17 00:00:00 2001 From: Simon Vrouwe Date: Fri, 18 Feb 2022 17:41:05 +0200 Subject: [PATCH] lightningd: fix parsing of option dev-force-features It did not pick-up the last (bolt11) bits set. --- lightningd/options.c | 10 +++++----- tests/test_connection.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lightningd/options.c b/lightningd/options.c index e851bc67f..d14b917fd 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -611,11 +611,11 @@ static char *opt_force_featureset(const char *optarg, struct lightningd *ld) { char **parts = tal_strsplit(tmpctx, optarg, "/", STR_EMPTY_OK); - if (tal_count(parts) != NUM_FEATURE_PLACE) { + if (tal_count(parts) != NUM_FEATURE_PLACE + 1) { if (!strstarts(optarg, "-") && !strstarts(optarg, "+")) - return "Expected 5 feature sets (init, globalinit," - " node_announce, channel, bolt11) separated" - " by / OR +/-"; + return "Expected 5 feature sets (init/globalinit/" + " node_announce/channel/bolt11) each terminated by /" + " OR +/-"; char *endp; long int n = strtol(optarg + 1, &endp, 10); @@ -712,7 +712,7 @@ static void dev_register_opts(struct lightningd *ld) &ld->plugins->dev_builtin_plugins_unimportant, "Make builtin plugins unimportant so you can plugin stop them."); opt_register_arg("--dev-force-features", opt_force_featureset, NULL, ld, - "Force the init/globalinit/node_announce/channel/bolt11 features, each comma-separated bitnumbers"); + "Force the init/globalinit/node_announce/channel/bolt11/ features, each comma-separated bitnumbers OR a single +/-"); opt_register_arg("--dev-timeout-secs", opt_set_u32, opt_show_u32, &ld->config.connection_timeout_secs, "Seconds to timeout if we don't receive INIT from peer"); diff --git a/tests/test_connection.py b/tests/test_connection.py index e19159d15..9e8179a11 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -3226,7 +3226,7 @@ def test_nonstatic_channel(node_factory, bitcoind): opts=[{}, # needs at least 15 to connect # (and 9 is a dependent) - {'dev-force-features': '9,15////'}]) + {'dev-force-features': '9,15/////'}]) chan = only_one(only_one(l1.rpc.listpeers()['peers'])['channels']) assert 'option_static_remotekey' not in chan['features'] assert 'option_anchor_outputs' not in chan['features']