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

Function match_inv_condition

lightningd/runes.c:727–748  ·  view source on GitHub ↗

Returns the parameter name and set *invf, or NULL */

Source from the content-addressed store, hash-verified

725
726/* Returns the parameter name and set *invf, or NULL */
727static 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
750static const char *check_bolt11_condition(const tal_t *ctx,
751 const struct rune_altern *alt,

Callers 1

check_inv_conditionFunction · 0.85

Calls 1

strendsFunction · 0.85

Tested by

no test coverage detected