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

Function jsonrpc_setup

lightningd/jsonrpc.c:1217–1232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1215#endif /* DEVELOPER */
1216
1217void jsonrpc_setup(struct lightningd *ld)
1218{
1219 struct json_command **commands = get_cmdlist();
1220
1221 ld->jsonrpc = tal(ld, struct jsonrpc);
1222 strmap_init(&ld->jsonrpc->usagemap);
1223 ld->jsonrpc->commands = tal_arr(ld->jsonrpc, struct json_command *, 0);
1224 for (size_t i=0; i<num_cmdlist; i++) {
1225 if (!jsonrpc_command_add_perm(ld, ld->jsonrpc, commands[i]))
1226 fatal("Cannot add duplicate command %s",
1227 commands[i]->name);
1228 }
1229 ld->jsonrpc->rpc_listener = NULL;
1230 tal_add_destructor(ld->jsonrpc, destroy_jsonrpc);
1231 memleak_add_helper(ld->jsonrpc, memleak_help_jsonrpc);
1232}
1233
1234bool command_usage_only(const struct command *cmd)
1235{

Callers 1

new_lightningdFunction · 0.70

Calls 3

get_cmdlistFunction · 0.85
jsonrpc_command_add_permFunction · 0.85
fatalFunction · 0.70

Tested by

no test coverage detected