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

Function all_supported_features

common/features.c:392–409  ·  view source on GitHub ↗

* all_supported_features - Check if we support what's being asked * * Given the features vector that the remote connection is expecting * from us, we check to see if we support all even bit features, i.e., * the required features. * * @bitmap: the features bitmap the peer is asking for * * Returns -1 on success, or first unsupported feature. */

Source from the content-addressed store, hash-verified

390 * Returns -1 on success, or first unsupported feature.
391 */
392static int all_supported_features(const struct feature_set *our_features,
393 const u8 *bitmap,
394 enum feature_place p)
395{
396 size_t len = tal_count(bitmap) * 8;
397
398 /* It's OK to be odd: only check even bits. */
399 for (size_t bitnum = 0; bitnum < len; bitnum += 2) {
400 if (!test_bit(bitmap, bitnum/8, bitnum%8))
401 continue;
402
403 if (feature_offered(our_features->bits[p], bitnum))
404 continue;
405
406 return bitnum;
407 }
408 return -1;
409}
410
411int features_unsupported(const struct feature_set *our_features,
412 const u8 *their_features,

Callers 1

features_unsupportedFunction · 0.85

Calls 2

test_bitFunction · 0.85
feature_offeredFunction · 0.70

Tested by

no test coverage detected