channeld: Code to implement splicing

Update the lightningd <-> channeld interface with lots of new commands to needed to facilitate spicing.

Implement the channeld splicing protocol leveraging the interactivetx protocol.

Implement lightningd’s channel_control to support channeld in its splicing efforts.

Changelog-Added: Added the features to enable splicing & resizing of active channels.
This commit is contained in:
Dusty Daemon
2023-07-27 14:37:52 -07:00
committed by Rusty Russell
parent ebd0a3fd69
commit 4628e3ace8
88 changed files with 4560 additions and 644 deletions

View File

@@ -1188,6 +1188,20 @@ static char *opt_set_dual_fund(struct lightningd *ld)
return NULL;
}
static char *opt_set_splicing(struct lightningd *ld)
{
/* Splicing requires STFU to be enabled */
feature_set_or(ld->our_features,
take(feature_set_for_feature(NULL,
OPTIONAL_FEATURE(OPT_QUIESCE))));
feature_set_or(ld->our_features,
take(feature_set_for_feature(NULL,
OPTIONAL_FEATURE(OPT_SPLICE))));
/* Splicing requires dual-fund to be enabled */
opt_set_dual_fund(ld);
return NULL;
}
static char *opt_set_onion_messages(struct lightningd *ld)
{
feature_set_or(ld->our_features,
@@ -1390,6 +1404,11 @@ static void register_opts(struct lightningd *ld)
" and allow peers to establish channels"
" via v2 channel open protocol.");
opt_register_early_noarg("--experimental-splicing",
opt_set_splicing, ld,
"experimental: Enables the ability to resize"
" channels using splicing");
/* This affects our features, so set early. */
opt_register_early_noarg("--experimental-onion-messages",
opt_set_onion_messages, ld,
@@ -1890,6 +1909,11 @@ void add_config_deprecated(struct lightningd *ld,
feature_offered(ld->our_features
->bits[INIT_FEATURE],
OPT_DUAL_FUND));
} else if (opt->cb == (void *)opt_set_splicing) {
json_add_bool(response, name0,
feature_offered(ld->our_features
->bits[INIT_FEATURE],
OPT_SPLICE));
} else if (opt->cb == (void *)opt_set_onion_messages) {
json_add_bool(response, name0,
feature_offered(ld->our_features