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

Function feature_set_for_feature

common/features.c:207–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207struct feature_set *feature_set_for_feature(const tal_t *ctx, int feature)
208{
209 struct feature_set *fs = tal(ctx, struct feature_set);
210
211 for (size_t i = 0; i < ARRAY_SIZE(fs->bits); i++) {
212 fs->bits[i] = tal_arr(fs, u8, 0);
213 switch (feature_copy_style(feature, i)) {
214 case FEATURE_DONT_REPRESENT:
215 continue;
216 case FEATURE_REPRESENT:
217 set_feature_bit(&fs->bits[i], feature);
218 continue;
219 case FEATURE_REPRESENT_AS_OPTIONAL:
220 set_feature_bit(&fs->bits[i], OPTIONAL_FEATURE(feature));
221 continue;
222 }
223 abort();
224 }
225 return fs;
226}
227
228bool feature_set_or(struct feature_set *a,
229 const struct feature_set *b TAKES)

Callers 1

mainFunction · 0.50

Calls 3

set_feature_bitFunction · 0.85
abortFunction · 0.85
feature_copy_styleFunction · 0.70

Tested by 1

mainFunction · 0.40