From 6336d39a95cae5cdab35ecc63e0f6f09a0eb8c9d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 2 Jul 2021 09:41:30 +0930 Subject: [PATCH] features: renumber from 102/103 to 38/39. 100+ is for experimentation, modern spec practice is to assign feature bits sequentially as PRs get added, to avoid later renumbering. Still respect the old bit for now. Signed-off-by: Rusty Russell --- common/features.c | 3 +-- common/features.h | 6 +++--- plugins/fetchinvoice.c | 4 +++- tests/test_pay.py | 2 +- tests/utils.py | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/common/features.c b/common/features.c index d77f51466..5e41d056a 100644 --- a/common/features.c +++ b/common/features.c @@ -397,7 +397,7 @@ static const char *feature_name(const tal_t *ctx, size_t f) NULL, NULL, NULL, - NULL, + "option_onion_messages", /* 38/39 */ NULL, /* 40/41 */ NULL, NULL, @@ -429,7 +429,6 @@ static const char *feature_name(const tal_t *ctx, size_t f) NULL, NULL, NULL, /* 100/101 */ - "option_onion_messages", /* 102/103 */ }; if (f / 2 >= ARRAY_SIZE(fnames) || !fnames[f / 2]) diff --git a/common/features.h b/common/features.h index 0de7c31c9..176dea86e 100644 --- a/common/features.h +++ b/common/features.h @@ -127,11 +127,11 @@ const char *fmt_featurebits(const tal_t *ctx, const u8 *featurebits); */ #define OPT_DUAL_FUND 28 -/* BOLT-9fc25cfd2895578c0b1ab701ebe6c1eb67a19623 #9: +/* BOLT-1ede04a1a3225581e265b3ce96984ba88253a4a4 #9: * - * | 102/103 | `option_onion_messages` |... INC+ ... + * | 38/39 | `option_onion_messages` |... INC+ ... */ -#define OPT_ONION_MESSAGES 102 +#define OPT_ONION_MESSAGES 38 #define OPT_SHUTDOWN_WRONG_FUNDING 104 diff --git a/plugins/fetchinvoice.c b/plugins/fetchinvoice.c index 1547ab452..50af60afb 100644 --- a/plugins/fetchinvoice.c +++ b/plugins/fetchinvoice.c @@ -516,7 +516,9 @@ static bool can_carry_onionmsg(const struct gossmap *map, /* Check features of recipient */ n = gossmap_nth_node(map, c, !dir); - return n && gossmap_node_get_feature(map, n, OPT_ONION_MESSAGES) != -1; + /* 102/103 was the old EXPERIMENTAL feature bit: remove soon! */ + return gossmap_node_get_feature(map, n, OPT_ONION_MESSAGES) != -1 + || gossmap_node_get_feature(map, n, 102) != -1; } /* Create path to node which can carry onion messages; if it can't find diff --git a/tests/test_pay.py b/tests/test_pay.py index 99a6e00dc..881fb5c7f 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -4168,7 +4168,7 @@ def test_fetchinvoice_autoconnect(node_factory, bitcoind): if EXPERIMENTAL_FEATURES: # We have to force option_onion_messages off! - opts1 = {'dev-force-features': '-103'} + opts1 = {'dev-force-features': '-39'} else: opts1 = {} l1, l2 = node_factory.line_graph(2, wait_for_announce=True, diff --git a/tests/utils.py b/tests/utils.py index 6f1d7842b..446ec0c81 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -23,7 +23,7 @@ def expected_peer_features(wumbo_channels=False, extra=[]): features = [1, 5, 7, 9, 11, 13, 15, 17, 27] if EXPERIMENTAL_FEATURES: # OPT_ONION_MESSAGES - features += [103] + features += [39] # option_anchor_outputs features += [21] if wumbo_channels: @@ -43,7 +43,7 @@ def expected_node_features(wumbo_channels=False, extra=[]): features = [1, 5, 7, 9, 11, 13, 15, 17, 27, 55] if EXPERIMENTAL_FEATURES: # OPT_ONION_MESSAGES - features += [103] + features += [39] # option_anchor_outputs features += [21] if wumbo_channels: