| 1457 | } |
| 1458 | |
| 1459 | static struct feature_set *json_to_feature_set(struct plugin *plugin, |
| 1460 | const char *buf, |
| 1461 | const jsmntok_t *features) |
| 1462 | { |
| 1463 | struct feature_set *fset = talz(plugin, struct feature_set); |
| 1464 | const jsmntok_t *t; |
| 1465 | size_t i; |
| 1466 | |
| 1467 | json_for_each_obj(i, t, features) { |
| 1468 | enum feature_place p; |
| 1469 | if (json_tok_streq(buf, t, "init")) |
| 1470 | p = INIT_FEATURE; |
| 1471 | else if (json_tok_streq(buf, t, "node")) |
| 1472 | p = NODE_ANNOUNCE_FEATURE; |
| 1473 | else if (json_tok_streq(buf, t, "channel")) |
| 1474 | p = CHANNEL_FEATURE; |
| 1475 | else if (json_tok_streq(buf, t, "invoice")) |
| 1476 | p = BOLT11_FEATURE; |
| 1477 | else if (json_tok_streq(buf, t, "bolt12_offer")) |
| 1478 | p = BOLT12_OFFER_FEATURE; |
| 1479 | else if (json_tok_streq(buf, t, "bolt12_invreq")) |
| 1480 | p = BOLT12_INVREQ_FEATURE; |
| 1481 | else if (json_tok_streq(buf, t, "bolt12_invoice")) |
| 1482 | p = BOLT12_INVOICE_FEATURE; |
| 1483 | else |
| 1484 | continue; |
| 1485 | fset->bits[p] = json_tok_bin_from_hex(fset, buf, t + 1); |
| 1486 | } |
| 1487 | return fset; |
| 1488 | } |
| 1489 | |
| 1490 | static struct plugin_option *find_opt(struct plugin *plugin, const char *name) |
| 1491 | { |
nothing calls this directly
no test coverage detected