* 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. */
| 376 | * Returns -1 on success, or first unsupported feature. |
| 377 | */ |
| 378 | static 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 | |
| 397 | int features_unsupported(const struct feature_set *our_features, |
| 398 | const u8 *their_features, |
no test coverage detected