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

Function default_features

lightningd/lightningd.c:888–948  ·  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

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

Callers 1

mainFunction · 0.85

Calls 2

feature_set_for_featureFunction · 0.85
feature_set_orFunction · 0.85

Tested by

no test coverage detected