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

Function check_features_and_chain

common/bolt12.c:54–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54static char *check_features_and_chain(const tal_t *ctx,
55 const struct feature_set *our_features,
56 const struct chainparams *must_be_chain,
57 const u8 *features,
58 enum feature_place fplace,
59 const struct bitcoin_blkid *chains,
60 size_t num_chains)
61{
62 if (must_be_chain) {
63 if (!bolt12_chains_match(chains, num_chains, must_be_chain))
64 return tal_fmt(ctx, "wrong chain");
65 } else {
66 /* Chains is *empty*, that can never work. */
67 if (chains && tal_count(chains) == 0)
68 return tal_fmt(ctx, "offer_chains with zero entries");
69 }
70
71 if (our_features) {
72 int badf = features_unsupported(our_features, features, fplace);
73 if (badf != -1)
74 return tal_fmt(ctx, "unknown feature bit %i", badf);
75 }
76
77 return NULL;
78}
79
80bool bolt12_check_signature(const struct tlv_field *fields,
81 const char *messagename,

Callers 3

offer_decodeFunction · 0.85
invrequest_decodeFunction · 0.85
invoice_decode_minimalFunction · 0.85

Calls 2

bolt12_chains_matchFunction · 0.85
features_unsupportedFunction · 0.70

Tested by

no test coverage detected