Returns the parameter name and set *invf, or NULL */
| 725 | |
| 726 | /* Returns the parameter name and set *invf, or NULL */ |
| 727 | static const char *match_inv_condition(const tal_t *ctx, |
| 728 | const char *fieldname, |
| 729 | enum invoice_field *invf) |
| 730 | { |
| 731 | struct { |
| 732 | const char *prefix; |
| 733 | enum invoice_field invf; |
| 734 | } fields[] = { {"_amount", INV_FIELD_AMOUNT}, |
| 735 | {"_description", INV_FIELD_DESCRIPTION}, |
| 736 | {"_node", INV_FIELD_NODE_ID}, |
| 737 | /* Insert new ones here! */ |
| 738 | }; |
| 739 | for (size_t i = 0; i < ARRAY_SIZE(fields); i++) { |
| 740 | if (strends(fieldname, fields[i].prefix)) { |
| 741 | *invf = fields[i].invf; |
| 742 | return tal_strndup(ctx, fieldname, |
| 743 | strlen(fieldname) |
| 744 | - strlen(fields[i].prefix)); |
| 745 | } |
| 746 | } |
| 747 | return NULL; |
| 748 | } |
| 749 | |
| 750 | static const char *check_bolt11_condition(const tal_t *ctx, |
| 751 | const struct rune_altern *alt, |
no test coverage detected