mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
common/features: use bitmaps internally, have explicit init function.
This is to prepare for dynamic features, including making plugins first class citizens at setting them. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
c59327dce1
commit
afb76392e4
@@ -1004,11 +1004,34 @@ void setup_color_and_alias(struct lightningd *ld)
|
||||
}
|
||||
}
|
||||
|
||||
static void setup_default_features(void)
|
||||
{
|
||||
static const u32 default_features[] = {
|
||||
OPTIONAL_FEATURE(OPT_DATA_LOSS_PROTECT),
|
||||
OPTIONAL_FEATURE(OPT_UPFRONT_SHUTDOWN_SCRIPT),
|
||||
OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES),
|
||||
OPTIONAL_FEATURE(OPT_VAR_ONION),
|
||||
OPTIONAL_FEATURE(OPT_PAYMENT_SECRET),
|
||||
OPTIONAL_FEATURE(OPT_BASIC_MPP),
|
||||
OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES_EX),
|
||||
OPTIONAL_FEATURE(OPT_STATIC_REMOTEKEY),
|
||||
};
|
||||
u8 *f = tal_arr(NULL, u8, 0);
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(default_features); i++)
|
||||
set_feature_bit(&f, default_features[i]);
|
||||
|
||||
features_core_init(take(f));
|
||||
}
|
||||
|
||||
void handle_early_opts(struct lightningd *ld, int argc, char *argv[])
|
||||
{
|
||||
/* Make ccan/opt use tal for allocations */
|
||||
setup_option_allocators();
|
||||
|
||||
/* Make sure options are populated. */
|
||||
setup_default_features();
|
||||
|
||||
/*~ List features immediately, before doing anything interesting */
|
||||
opt_register_early_noarg("--list-features-only",
|
||||
list_features_and_exit,
|
||||
|
||||
Reference in New Issue
Block a user