| 205 | } |
| 206 | |
| 207 | struct 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 | |
| 228 | bool feature_set_or(struct feature_set *a, |
| 229 | const struct feature_set *b TAKES) |