Browse Source

experimental-dual-fund: add config level option for enabling dual-fund

Allow a user to switch on dual-funding without needing to compile
as EXPERIMENTAL_FEATURES.

Doesn't work yet, since everything is still behind
'EXPERIMENTAL_FEATURES' compile time flags... but useful for testing
ppa
niftynei 4 years ago
committed by Christian Decker
parent
commit
327d9a3ff6
  1. 10
      common/features.h
  2. 20
      lightningd/options.c

10
common/features.h

@ -113,16 +113,16 @@ u8 *featurebits_or(const tal_t *ctx, const u8 *f1 TAKES, const u8 *f2 TAKES);
#define OPT_LARGE_CHANNELS 18
#define OPT_ANCHOR_OUTPUTS 20
/* BOLT-7b04b1461739c5036add61782d58ac490842d98b #9:
* | 222/223 | `option_dual_fund` | ... IN9 ...
*/
#define OPT_DUAL_FUND 222
/* BOLT-9fc25cfd2895578c0b1ab701ebe6c1eb67a19623 #9:
*
* | 102/103 | `option_onion_messages` |... INC+ ...
*/
#if EXPERIMENTAL_FEATURES
#define OPT_ONION_MESSAGES 102
/* BOLT-7b04b1461739c5036add61782d58ac490842d98b #9:
* | 222/223 | `option_dual_fund` | ... IN9 ...
*/
#define OPT_DUAL_FUND 222
#endif
#endif /* LIGHTNING_COMMON_FEATURES_H */

20
lightningd/options.c

@ -791,6 +791,14 @@ static char *opt_set_wumbo(struct lightningd *ld)
return NULL;
}
static char *opt_set_dual_fund(struct lightningd *ld)
{
feature_set_or(ld->our_features,
take(feature_set_for_feature(NULL,
OPTIONAL_FEATURE(OPT_DUAL_FUND))));
return NULL;
}
static void register_opts(struct lightningd *ld)
{
/* This happens before plugins started */
@ -832,6 +840,13 @@ static void register_opts(struct lightningd *ld)
opt_set_wumbo, ld,
"Allow channels larger than 0.16777215 BTC");
opt_register_early_noarg("--experimental-dual-fund",
opt_set_dual_fund, ld,
"experimental: Advertise dual-funding"
" and allow peers to establish channels"
" via v2 channel open protocol");
opt_register_noarg("--help|-h", opt_lightningd_usage, ld,
"Print this message.");
opt_register_arg("--rgb", opt_set_rgb, NULL, ld,
@ -1242,6 +1257,11 @@ static void add_config(struct lightningd *ld,
feature_offered(ld->our_features
->bits[INIT_FEATURE],
OPT_LARGE_CHANNELS));
} else if (opt->cb == (void *)opt_set_dual_fund) {
json_add_bool(response, name0,
feature_offered(ld->our_features
->bits[INIT_FEATURE],
OPT_DUAL_FUND));
} else if (opt->cb == (void *)plugin_opt_flag_set) {
/* Noop, they will get added below along with the
* OPT_HASARG options. */

Loading…
Cancel
Save