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

Function match_inv_condition

lightningd/runes.c:696–717  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

694
695/* Returns the parameter name and set *invf, or NULL */
696static 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
719static const char *check_bolt11_condition(const tal_t *ctx,
720 const struct rune_altern *alt,

Callers 1

check_inv_conditionFunction · 0.85

Calls 1

strendsFunction · 0.85

Tested by

no test coverage detected