BOLT #11: * * `9` (5): `data_length` variable. One or more 5-bit values containing features * supported or required for receiving this payment. * See [Feature Bits](#feature-bits). */
| 501 | * See [Feature Bits](#feature-bits). |
| 502 | */ |
| 503 | static char *decode_9(struct bolt11 *b11, |
| 504 | const struct feature_set *our_features, |
| 505 | struct hash_u5 *hu5, |
| 506 | u5 **data, size_t *data_len, |
| 507 | size_t data_length) |
| 508 | { |
| 509 | size_t flen = (data_length * 5 + 7) / 8; |
| 510 | int badf; |
| 511 | |
| 512 | b11->features = tal_arr(b11, u8, flen); |
| 513 | pull_bits_certain(hu5, data, data_len, b11->features, |
| 514 | data_length * 5, true); |
| 515 | |
| 516 | /* pull_bits pads with zero bits: we need to remove them. */ |
| 517 | shift_bitmap_down(b11->features, |
| 518 | flen * 8 - data_length * 5); |
| 519 | |
| 520 | /* BOLT #11: |
| 521 | * |
| 522 | * - if the `9` field contains unknown _odd_ bits that are non-zero: |
| 523 | * - MUST ignore the bit. |
| 524 | * - if the `9` field contains unknown _even_ bits that are non-zero: |
| 525 | * - MUST fail the payment. |
| 526 | */ |
| 527 | /* We skip this check for the cli tool, which sets our_features to NULL */ |
| 528 | if (our_features) { |
| 529 | badf = features_unsupported(our_features, |
| 530 | b11->features, BOLT11_FEATURE); |
| 531 | if (badf != -1) |
| 532 | return tal_fmt(b11, "9: unknown feature bit %i", badf); |
| 533 | } |
| 534 | |
| 535 | return NULL; |
| 536 | } |
| 537 | |
| 538 | /* BOLT #11: |
| 539 | * |
no test coverage detected