MCPcopy Create free account
hub / github.com/ElementsProject/lightning / print_bip353_name

Function print_bip353_name

devtools/bolt12-cli.c:430–456  ·  view source on GitHub ↗

FIXME: Can name and domain be missing? */

Source from the content-addressed store, hash-verified

428
429/* FIXME: Can name and domain be missing? */
430static bool print_bip353_name(const char *fieldname,
431 const u8 *bip353_name, const u8 *bip353_domain)
432{
433 /* BOLT #12:
434 * - if `invreq_bip_353_name` is present:
435 * - MUST reject the invoice request if `name` or `domain`
436 * contain any bytes which are not `0`-`9`, `a`-`z`,
437 * `A`-`Z`, `-`, `_` or `.`.
438 */
439 if (!bolt12_bip353_valid_string(bip353_name,
440 tal_bytelen(bip353_name))) {
441 fprintf(stderr, "Invalid chars in invreq_bip_353_name.name\n");
442 return false;
443 }
444 if (!bolt12_bip353_valid_string(bip353_domain,
445 tal_bytelen(bip353_domain))) {
446 fprintf(stderr, "Invalid chars in invreq_bip_353_name.domain\n");
447 return false;
448 }
449 if (bip353_name)
450 printf("%s.name: %.*s\n", fieldname,
451 (int)tal_bytelen(bip353_name), (char *)bip353_name);
452 if (bip353_domain)
453 printf("%s.domain: %.*s\n", fieldname,
454 (int)tal_bytelen(bip353_domain), (char *)bip353_domain);
455 return true;
456}
457
458static bool print_extra_fields(const struct tlv_field *fields)
459{

Callers 1

mainFunction · 0.85

Calls 2

tal_bytelenFunction · 0.85

Tested by

no test coverage detected