| 160 | } |
| 161 | |
| 162 | static bool print_utf8(const char *fieldname, const utf8 *description) |
| 163 | { |
| 164 | size_t len = tal_bytelen(description); |
| 165 | bool valid = utf8_check(description, len); |
| 166 | |
| 167 | /* Decoded TLV utf8 fields are length-delimited, not necessarily NUL-terminated. */ |
| 168 | if (len != 0 && description[len - 1] == '\0') |
| 169 | len--; |
| 170 | |
| 171 | printf("%s: %.*s%s\n", fieldname, |
| 172 | (int)len, description, |
| 173 | valid ? "" : "(INVALID UTF-8)"); |
| 174 | return valid; |
| 175 | } |
| 176 | |
| 177 | static void print_node_id(const char *fieldname, const struct pubkey *node_id) |
| 178 | { |
no test coverage detected