BOLT #11: * * `d` (13): `data_length` variable. Short description of purpose of payment * (UTF-8), e.g. '1 cup of coffee' or 'ナンセンス 1杯' */
| 182 | * (UTF-8), e.g. '1 cup of coffee' or 'ナンセンス 1杯' |
| 183 | */ |
| 184 | static char *decode_d(struct bolt11 *b11, |
| 185 | struct hash_u5 *hu5, |
| 186 | u5 **data, size_t *data_len, |
| 187 | size_t data_length, bool *have_d) |
| 188 | { |
| 189 | u8 *desc; |
| 190 | if (*have_d) |
| 191 | return unknown_field(b11, hu5, data, data_len, 'd', data_length); |
| 192 | |
| 193 | desc = tal_arr(NULL, u8, data_length * 5 / 8); |
| 194 | pull_bits_certain(hu5, data, data_len, desc, data_length*5, false); |
| 195 | |
| 196 | *have_d = true; |
| 197 | b11->description = utf8_str(b11, take(desc), tal_bytelen(desc)); |
| 198 | if (b11->description) |
| 199 | return NULL; |
| 200 | |
| 201 | return tal_fmt(b11, "d: invalid utf8"); |
| 202 | } |
| 203 | |
| 204 | /* BOLT #11: |
| 205 | * |
no test coverage detected