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

Function bool_setting

lightningd/plugin.c:964–983  ·  view source on GitHub ↗

Sets *ret to false if it doesn't appear, otherwise, sets to value */

Source from the content-addressed store, hash-verified

962
963/* Sets *ret to false if it doesn't appear, otherwise, sets to value */
964static char *bool_setting(tal_t *ctx,
965 const char *optname,
966 const char *buffer,
967 const jsmntok_t *opt,
968 const char *tokname,
969 bool *ret)
970{
971 const jsmntok_t *tok = json_get_member(buffer, opt, tokname);
972 if (!tok) {
973 *ret = false;
974 return NULL;
975 }
976 if (!json_to_bool(buffer, tok, ret))
977 return tal_fmt(ctx,
978 "%s: invalid \"%s\" field %.*s",
979 optname, tokname,
980 tok->end - tok->start,
981 buffer + tok->start);
982 return NULL;
983}
984
985/* Parse deprecated field, as either bool or an array of strings */
986static const char *json_parse_deprecated(const tal_t *ctx,

Callers 2

plugin_opt_addFunction · 0.85

Calls 2

json_get_memberFunction · 0.85
json_to_boolFunction · 0.50

Tested by

no test coverage detected