features: match up feature names to feature bit

Aligns the feature bit number to the name-label. Is this correct?
This commit is contained in:
niftynei
2021-03-11 18:21:58 -06:00
committed by Rusty Russell
parent 3e8f575f9e
commit e549746578
2 changed files with 42 additions and 5 deletions

View File

@@ -380,21 +380,58 @@ int features_unsupported(const struct feature_set *our_features,
static const char *feature_name(const tal_t *ctx, size_t f)
{
static const char *fnames[] = {
"option_data_loss_protect",
"option_data_loss_protect", /* 0/1 */
"option_initial_routing_sync",
"option_upfront_shutdown_script",
"option_gossip_queries",
"option_var_onion_optin",
"option_gossip_queries_ex",
"option_gossip_queries_ex", /* 10/11 */
"option_static_remotekey",
"option_payment_secret",
"option_basic_mpp",
"option_support_large_channel",
"option_anchor_outputs",
"option_dual_fund",
"option_anchor_outputs", /* 20/21 */
"option_anchors_zero_fee_htlc_tx",
NULL,
"option_shutdown_anysegwit",
"option_dual_fund",
NULL, /* 30/31 */
NULL,
NULL,
NULL,
NULL,
NULL, /* 40/41 */
NULL,
NULL,
NULL,
NULL,
NULL, /* 50/51 */
NULL,
NULL,
NULL,
NULL,
NULL, /* 60/61 */
NULL,
NULL,
NULL,
NULL,
NULL, /* 70/71 */
NULL,
NULL,
NULL,
NULL,
NULL, /* 80/81 */
NULL,
NULL,
NULL,
NULL,
NULL, /* 90/91 */
NULL,
NULL,
NULL,
NULL,
NULL, /* 100/101 */
"option_onion_messages", /* 102/103 */
};
if (f / 2 >= ARRAY_SIZE(fnames) || !fnames[f / 2])

View File

@@ -1897,7 +1897,7 @@ def test_list_features_only(node_factory):
if EXPERIMENTAL_FEATURES:
expected += ['option_anchor_outputs/odd']
expected += ['option_shutdown_anysegwit/odd']
expected += ['option_unknown_102/odd']
expected += ['option_onion_messages/odd']
assert features == expected