From 91caf4cc303e4fc52219789d0d52bed4329055a0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 8 Sep 2020 14:50:15 +0930 Subject: [PATCH] options: handle wumbo and large-channels aliases properly. Too trivial a fix to really list in Changelog, but I noticed that we specified "wumbo" twice. We should really just use the proper name in listconfigs. Signed-off-by: Rusty Russell --- lightningd/options.c | 5 ++++- tests/test_misc.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lightningd/options.c b/lightningd/options.c index 1b8f5a113..f795ac845 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -1241,7 +1241,7 @@ static void add_config(struct lightningd *ld, } else if (opt->cb == (void *)opt_set_hsm_password) { json_add_bool(response, "encrypted-hsm", ld->encrypted_hsm); } else if (opt->cb == (void *)opt_set_wumbo) { - json_add_bool(response, "wumbo", + json_add_bool(response, name0, feature_offered(ld->our_features ->bits[INIT_FEATURE], OPT_LARGE_CHANNELS)); @@ -1387,6 +1387,9 @@ static struct command_result *json_listconfigs(struct command *cmd, response = json_stream_success(cmd); add_config(cmd->ld, response, &opt_table[i], name+1, len-1); + /* If we have more than one long name, first + * is preferred */ + break; } } diff --git a/tests/test_misc.py b/tests/test_misc.py index 491dd6fea..e9d7f51bd 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -807,6 +807,10 @@ def test_listconfigs(node_factory, bitcoind, chainparams): assert configs['ignore-fee-limits'] is False assert configs['log-prefix'] == 'lightning1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...' + # These are aliases, but we don't print the (unofficial!) wumbo. + assert 'wumbo' not in configs + assert configs['large-channels'] is False + # Test one at a time. for c in configs.keys(): if c.startswith('#') or c.startswith('plugins') or c == 'important-plugins':