Returns the parameter name and set *invf, or NULL */
| 694 | |
| 695 | /* Returns the parameter name and set *invf, or NULL */ |
| 696 | static const char *match_inv_condition(const tal_t *ctx, |
| 697 | const char *fieldname, |
| 698 | enum invoice_field *invf) |
| 699 | { |
| 700 | struct { |
| 701 | const char *prefix; |
| 702 | enum invoice_field invf; |
| 703 | } fields[] = { {"_amount", INV_FIELD_AMOUNT}, |
| 704 | {"_description", INV_FIELD_DESCRIPTION}, |
| 705 | {"_node", INV_FIELD_NODE_ID}, |
| 706 | /* Insert new ones here! */ |
| 707 | }; |
| 708 | for (size_t i = 0; i < ARRAY_SIZE(fields); i++) { |
| 709 | if (strends(fieldname, fields[i].prefix)) { |
| 710 | *invf = fields[i].invf; |
| 711 | return tal_strndup(ctx, fieldname, |
| 712 | strlen(fieldname) |
| 713 | - strlen(fields[i].prefix)); |
| 714 | } |
| 715 | } |
| 716 | return NULL; |
| 717 | } |
| 718 | |
| 719 | static const char *check_bolt11_condition(const tal_t *ctx, |
| 720 | const struct rune_altern *alt, |
no test coverage detected