MCPcopy Create free account
hub / github.com/ElementsProject/lightning / default_features

Function default_features

lightningd/lightningd.c:885–945  ·  view source on GitHub ↗

~ We actually keep more than one set of features, used in different * contexts. common/features.c knows how each standard feature is * presented, so we have it generate the set for each one at a time, and * combine them. * * This is inefficient, but the primitives are useful for adding single * features later, or adding them when supplied by plugins. */

Source from the content-addressed store, hash-verified

883 * This is inefficient, but the primitives are useful for adding single
884 * features later, or adding them when supplied by plugins. */
885static struct feature_set *default_features(const tal_t *ctx)
886{
887 /* Proposed BOLT PR https://github.com/lightning/bolts/pull/1092
888 * suggests making the following compulsory:
889 * var_onion_optin (all but 6 nodes)
890 * gossip_queries (all but 11 nodes)
891 * option_data_loss_protect (all but 11 nodes)
892 * option_static_remotekey (all but 16 nodes)
893 */
894 /* BOLT #9:
895 * The origin node:
896 * * If it supports a feature above, SHOULD set the corresponding odd
897 * bit in all feature fields indicated by the Context column unless
898 * indicated that it must set the even feature bit instead.
899 * * If it requires a feature above, MUST set the corresponding even
900 * feature bit in all feature fields indicated by the Context column,
901 * unless indicated that it must set the odd feature bit instead.
902 * * MUST NOT set feature bits it does not support.
903 * * MUST NOT set feature bits in fields not specified by the table above.
904 * * MUST NOT set both the optional and mandatory bits.
905 * * MUST set all transitive feature dependencies.
906 * * MUST support:
907 * * `var_onion_optin`
908 */
909 struct feature_set *ret = NULL;
910 static const u32 features[] = {
911 COMPULSORY_FEATURE(OPT_DATA_LOSS_PROTECT),
912 OPTIONAL_FEATURE(OPT_UPFRONT_SHUTDOWN_SCRIPT),
913 OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES),
914 COMPULSORY_FEATURE(OPT_VAR_ONION),
915 COMPULSORY_FEATURE(OPT_PAYMENT_SECRET),
916 OPTIONAL_FEATURE(OPT_BASIC_MPP),
917 OPTIONAL_FEATURE(OPT_LARGE_CHANNELS),
918 OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES_EX),
919 COMPULSORY_FEATURE(OPT_STATIC_REMOTEKEY),
920 OPTIONAL_FEATURE(OPT_SHUTDOWN_ANYSEGWIT),
921 OPTIONAL_FEATURE(OPT_PAYMENT_METADATA),
922 OPTIONAL_FEATURE(OPT_SCID_ALIAS),
923 OPTIONAL_FEATURE(OPT_ZEROCONF),
924 OPTIONAL_FEATURE(OPT_QUIESCE),
925 OPTIONAL_FEATURE(OPT_ONION_MESSAGES),
926 COMPULSORY_FEATURE(OPT_CHANNEL_TYPE),
927 OPTIONAL_FEATURE(OPT_ROUTE_BLINDING),
928 OPTIONAL_FEATURE(OPT_PROVIDE_STORAGE),
929 /* Removed later for elements */
930 OPTIONAL_FEATURE(OPT_ANCHORS_ZERO_FEE_HTLC_TX),
931 OPTIONAL_FEATURE(OPT_SPLICE),
932 };
933
934 for (size_t i = 0; i < ARRAY_SIZE(features); i++) {
935 struct feature_set *f;
936
937 f = feature_set_for_feature(NULL, features[i]);
938 if (!ret)
939 ret = tal_steal(ctx, f);
940 else
941 feature_set_or(ret, take(f));
942 }

Callers 1

mainFunction · 0.85

Calls 2

feature_set_for_featureFunction · 0.85
feature_set_orFunction · 0.85

Tested by

no test coverage detected