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

Function all_supported_features

common/features.c:378–395  ·  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

376 * Returns -1 on success, or first unsupported feature.
377 */
378static int all_supported_features(const struct feature_set *our_features,
379 const u8 *bitmap,
380 enum feature_place p)
381{
382 size_t len = tal_count(bitmap) * 8;
383
384 /* It's OK to be odd: only check even bits. */
385 for (size_t bitnum = 0; bitnum < len; bitnum += 2) {
386 if (!test_bit(bitmap, bitnum/8, bitnum%8))
387 continue;
388
389 if (feature_offered(our_features->bits[p], bitnum))
390 continue;
391
392 return bitnum;
393 }
394 return -1;
395}
396
397int features_unsupported(const struct feature_set *our_features,
398 const u8 *their_features,

Callers 1

features_unsupportedFunction · 0.85

Calls 2

test_bitFunction · 0.85
feature_offeredFunction · 0.85

Tested by

no test coverage detected