From c50e93d9fbd8ba6a2b01f8174c6e7d7aeb2fcc6e Mon Sep 17 00:00:00 2001 From: Dusty Daemon Date: Thu, 10 Aug 2023 09:50:29 +0930 Subject: [PATCH] splice: Move splice to experimental feature bit This was recommended by @t-bast: if the final spec commits to something compatible, we can simply advertize and accept both features, but if it does change in incompatible ways we won't cause problems for nodes who implement the official spec. (I split this, so first, we remove the OPT_SPLICE entirely, to make sure we caught them all. --RR) Suggested-by: @t-bast Changelog-None --- channeld/channeld.c | 2 +- common/features.c | 37 +++++++++++++++++++++- common/features.h | 6 +++- contrib/pyln-client/pyln/client/gossmap.py | 1 + lightningd/channel_control.c | 2 +- lightningd/options.c | 4 +-- tests/utils.py | 4 +-- 7 files changed, 48 insertions(+), 8 deletions(-) diff --git a/channeld/channeld.c b/channeld/channeld.c index 13c5a4fcd..5d3ae1dde 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -1494,7 +1494,7 @@ static u8 *send_commit_part(struct peer *peer, * send unless negotiated */ if (feature_negotiated(peer->our_features, peer->their_features, - OPT_SPLICE)) { + OPT_EXPERIMENTAL_SPLICE)) { status_debug("send_commit_part(splice: %d, remote_splice: %d)", (int)splice_amnt, (int)remote_splice_amnt); diff --git a/common/features.c b/common/features.c index 89c1bd047..daeaa5875 100644 --- a/common/features.c +++ b/common/features.c @@ -142,7 +142,7 @@ static const struct feature_style feature_styles[] = { { OPT_PROVIDE_PEER_BACKUP_STORAGE, .copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT, [NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT } }, - { OPT_SPLICE, + { OPT_EXPERIMENTAL_SPLICE, .copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT, [NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT, [CHANNEL_FEATURE] = FEATURE_DONT_REPRESENT} }, @@ -491,6 +491,41 @@ const char *feature_name(const tal_t *ctx, size_t f) NULL, NULL, NULL, /* 100/101 */ + NULL, + NULL, + NULL, + NULL, + NULL, /* 110/111 */ + NULL, + NULL, + NULL, + NULL, + NULL, /* 120/121 */ + NULL, + NULL, + NULL, + NULL, + NULL, /* 130/131 */ + NULL, + NULL, + NULL, + NULL, + NULL, /* 140/141 */ + NULL, + NULL, + NULL, + NULL, + NULL, /* 150/151 */ + NULL, + NULL, + NULL, + NULL, + NULL, /* 160/161 */ + "option_experimental_splice", /* https://github.com/lightning/bolts/pull/863 */ + NULL, + NULL, + NULL, + NULL, /* 170/171 */ }; if (f / 2 >= ARRAY_SIZE(fnames) || !fnames[f / 2]) diff --git a/common/features.h b/common/features.h index 31728d1f2..27e0811ab 100644 --- a/common/features.h +++ b/common/features.h @@ -136,7 +136,11 @@ struct feature_set *feature_set_dup(const tal_t *ctx, #define OPT_SHUTDOWN_ANYSEGWIT 26 #define OPT_CHANNEL_TYPE 44 #define OPT_PAYMENT_METADATA 48 -#define OPT_SPLICE 62 + +/* BOLT-splice #9: + * | 62/63 | `option_splice` | ... IN ... + */ +#define OPT_EXPERIMENTAL_SPLICE 162 /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #9: * | 28/29 | `option_dual_fund` | ... IN9 ... diff --git a/contrib/pyln-client/pyln/client/gossmap.py b/contrib/pyln-client/pyln/client/gossmap.py index ad6e681b8..88641cbba 100755 --- a/contrib/pyln-client/pyln/client/gossmap.py +++ b/contrib/pyln-client/pyln/client/gossmap.py @@ -74,6 +74,7 @@ class LnFeatureBits(object): OPTION_PROPOSED_UPFRONT_FEE = 56 # IN9 #1052 OPTION_PROPOSED_CLOSING_REJECTED = 60 # IN #1016 OPTION_PROPOSED_SPLICE = 62 # IN #863 + OPTION_PROPOSED_EXPERIMENTAL_SPLICE = 162 # IN #863 def _parse_features(featurebytes): diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index cd59faf91..ab698564b 100644 --- a/lightningd/channel_control.c +++ b/lightningd/channel_control.c @@ -1869,7 +1869,7 @@ static struct command_result *param_channel_for_splice(struct command *cmd, if (!feature_negotiated(cmd->ld->our_features, (*channel)->peer->their_features, - OPT_SPLICE)) + OPT_EXPERIMENTAL_SPLICE)) return command_fail(cmd, SPLICE_NOT_SUPPORTED, "splicing not supported"); diff --git a/lightningd/options.c b/lightningd/options.c index e1a30d3e6..856a1086e 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -1196,7 +1196,7 @@ static char *opt_set_splicing(struct lightningd *ld) OPTIONAL_FEATURE(OPT_QUIESCE)))); feature_set_or(ld->our_features, take(feature_set_for_feature(NULL, - OPTIONAL_FEATURE(OPT_SPLICE)))); + OPTIONAL_FEATURE(OPT_EXPERIMENTAL_SPLICE)))); return NULL; } @@ -1911,7 +1911,7 @@ void add_config_deprecated(struct lightningd *ld, json_add_bool(response, name0, feature_offered(ld->our_features ->bits[INIT_FEATURE], - OPT_SPLICE)); + OPT_EXPERIMENTAL_SPLICE)); } else if (opt->cb == (void *)opt_set_onion_messages) { json_add_bool(response, name0, feature_offered(ld->our_features diff --git a/tests/utils.py b/tests/utils.py index 789b7b802..3063b89af 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -44,7 +44,7 @@ def expected_peer_features(wumbo_channels=False, extra=[]): features += [29] if EXPERIMENTAL_SPLICING: features += [35] # option_quiesce - features += [63] # option_splice + features += [163] # option_experimental_splice return hex_bits(features + extra) @@ -60,7 +60,7 @@ def expected_node_features(wumbo_channels=False, extra=[]): features += [29] if EXPERIMENTAL_SPLICING: features += [35] # option_quiesce - features += [63] # option_splice + features += [163] # option_experimental_splice return hex_bits(features + extra)