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

Function param_mode

lightningd/datastore.c:35–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33};
34
35static struct command_result *param_mode(struct command *cmd,
36 const char *name,
37 const char *buffer,
38 const jsmntok_t *tok,
39 enum ds_mode **mode)
40{
41 *mode = tal(cmd, enum ds_mode);
42 if (json_tok_streq(buffer, tok, "must-create"))
43 **mode = DS_MUST_NOT_EXIST;
44 else if (json_tok_streq(buffer, tok, "must-replace"))
45 **mode = DS_MUST_EXIST;
46 else if (json_tok_streq(buffer, tok, "create-or-replace"))
47 **mode = 0;
48 else if (json_tok_streq(buffer, tok, "must-append"))
49 **mode = DS_MUST_EXIST | DS_APPEND;
50 else if (json_tok_streq(buffer, tok, "create-or-append"))
51 **mode = DS_APPEND;
52 else
53 return command_fail_badparam(cmd, name, buffer, tok,
54 "should be 'must-create',"
55 " 'must-replace',"
56 " 'create-or-replace',"
57 " 'must-append',"
58 " or 'create-or-append'");
59
60 return NULL;
61}
62
63static struct command_result *param_list_or_string(struct command *cmd,
64 const char *name,

Callers

nothing calls this directly

Calls 2

command_fail_badparamFunction · 0.85
json_tok_streqFunction · 0.50

Tested by

no test coverage detected