diff --git a/common/features.c b/common/features.c index fa8c20c8b..3cf4c6c76 100644 --- a/common/features.c +++ b/common/features.c @@ -73,6 +73,10 @@ static const struct feature_style feature_styles[] = { [NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT, [BOLT11_FEATURE] = FEATURE_REPRESENT, [CHANNEL_FEATURE] = FEATURE_DONT_REPRESENT} }, + { OPT_SHUTDOWN_WRONG_FUNDING, + .copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT, + [NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT, + [CHANNEL_FEATURE] = FEATURE_DONT_REPRESENT} }, #if EXPERIMENTAL_FEATURES { OPT_ANCHOR_OUTPUTS, .copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT, diff --git a/common/features.h b/common/features.h index a0ce2d2a7..da0a49ea1 100644 --- a/common/features.h +++ b/common/features.h @@ -129,4 +129,7 @@ u8 *featurebits_or(const tal_t *ctx, const u8 *f1 TAKES, const u8 *f2 TAKES); * | 102/103 | `option_onion_messages` |... INC+ ... */ #define OPT_ONION_MESSAGES 102 + +#define OPT_SHUTDOWN_WRONG_FUNDING 104 + #endif /* LIGHTNING_COMMON_FEATURES_H */ diff --git a/doc/lightningd-config.5 b/doc/lightningd-config.5 index 9bb2c166c..887b848d6 100644 --- a/doc/lightningd-config.5 +++ b/doc/lightningd-config.5 @@ -583,6 +583,15 @@ corresponding functionality, which are in draft status as BOLT12\. This usually requires \fBexperimental-onion-messages\fR as well\. See \fBlightning-offer\fR(7) and \fBlightning-fetchinvoice\fR(7)\. + + \fBexperimental-shutdown-wrong-funding\fR + + +Specifying this allows the \fBwrong_funding\fR field in shutdown: if a +remote node has opened a channel using the incorrect txid (and it +hasn't been used yet at all) this allows them to negotiate a clean +shutdown with the txid they offer\. + .SH BUGS You should report bugs on our github issues page, and maybe submit a fix @@ -608,4 +617,4 @@ Main web site: \fIhttps://github.com/ElementsProject/lightning\fR Note: the modules in the ccan/ directory have their own licenses, but the rest of the code is covered by the BSD-style MIT license\. -\" SHA256STAMP:8e18374d48aff1d2574667c603e36cdac81c35e09a49397dc6982f1688dd454a +\" SHA256STAMP:ecfd7ac60b50a20cad39dfa0e423e4885256a94658b5886f577df50773555e7e diff --git a/doc/lightningd-config.5.md b/doc/lightningd-config.5.md index 8ccbfcae6..67ae212e0 100644 --- a/doc/lightningd-config.5.md +++ b/doc/lightningd-config.5.md @@ -483,6 +483,13 @@ corresponding functionality, which are in draft status as BOLT12. This usually requires **experimental-onion-messages** as well. See lightning-offer(7) and lightning-fetchinvoice(7). + **experimental-shutdown-wrong-funding** + +Specifying this allows the `wrong_funding` field in shutdown: if a +remote node has opened a channel using the incorrect txid (and it +hasn't been used yet at all) this allows them to negotiate a clean +shutdown with the txid they offer. + BUGS ---- diff --git a/lightningd/options.c b/lightningd/options.c index 586c4d386..8db087b45 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -814,6 +814,14 @@ static char *opt_set_onion_messages(struct lightningd *ld) return NULL; } +static char *opt_set_shutdown_wrong_funding(struct lightningd *ld) +{ + feature_set_or(ld->our_features, + take(feature_set_for_feature(NULL, + OPTIONAL_FEATURE(OPT_SHUTDOWN_WRONG_FUNDING)))); + return NULL; +} + static char *opt_set_offers(struct lightningd *ld) { ld->config.exp_offers = true; @@ -878,6 +886,9 @@ static void register_opts(struct lightningd *ld) opt_set_offers, ld, "EXPERIMENTAL: enable send and receive of offers" " (also sets experimental-onion-messages)"); + opt_register_early_noarg("--experimental-shutdown-wrong-funding", + opt_set_shutdown_wrong_funding, ld, + "EXPERIMENTAL: allow shutdown with alternate txids"); opt_register_noarg("--help|-h", opt_lightningd_usage, ld, "Print this message."); @@ -1301,6 +1312,11 @@ static void add_config(struct lightningd *ld, OPT_ONION_MESSAGES)); } else if (opt->cb == (void *)opt_set_offers) { json_add_bool(response, name0, ld->config.exp_offers); + } else if (opt->cb == (void *)opt_set_shutdown_wrong_funding) { + json_add_bool(response, name0, + feature_offered(ld->our_features + ->bits[INIT_FEATURE], + OPT_SHUTDOWN_WRONG_FUNDING)); } else if (opt->cb == (void *)plugin_opt_flag_set) { /* Noop, they will get added below along with the * OPT_HASARG options. */