Skip to content

Commit

Permalink
splice: Move splice to experimental feature bit
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ddustin authored and rustyrussell committed Aug 10, 2023
1 parent 5f8b774 commit c50e93d
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion channeld/channeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
37 changes: 36 additions & 1 deletion common/features.c
Original file line number Diff line number Diff line change
Expand Up @@ -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} },
Expand Down Expand Up @@ -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])
Expand Down
6 changes: 5 additions & 1 deletion common/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand Down
1 change: 1 addition & 0 deletions contrib/pyln-client/pyln/client/gossmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion lightningd/channel_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
4 changes: 2 additions & 2 deletions lightningd/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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)


Expand Down

0 comments on commit c50e93d

Please sign in to comment.