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

Function param_positive_msat_or_any

lightningd/invoice.c:1010–1027  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1008#endif /* DEVELOPER */
1009
1010static struct command_result *param_positive_msat_or_any(struct command *cmd,
1011 const char *name,
1012 const char *buffer,
1013 const jsmntok_t *tok,
1014 struct amount_msat **msat)
1015{
1016 if (json_tok_streq(buffer, tok, "any")) {
1017 *msat = NULL;
1018 return NULL;
1019 }
1020 *msat = tal(cmd, struct amount_msat);
1021 if (parse_amount_msat(*msat, buffer + tok->start, tok->end - tok->start)
1022 && !amount_msat_eq(**msat, AMOUNT_MSAT(0)))
1023 return NULL;
1024
1025 return command_fail_badparam(cmd, name, buffer, tok,
1026 "should be positive msat or 'any'");
1027}
1028
1029/* Parse time with optional suffix, return seconds */
1030static struct command_result *param_time(struct command *cmd, const char *name,

Callers

nothing calls this directly

Calls 4

command_fail_badparamFunction · 0.85
json_tok_streqFunction · 0.50
parse_amount_msatFunction · 0.50
amount_msat_eqFunction · 0.50

Tested by

no test coverage detected