| 1376 | } |
| 1377 | |
| 1378 | void jsonrpc_setup(struct lightningd *ld) |
| 1379 | { |
| 1380 | size_t num_cmdlist; |
| 1381 | struct json_command **commands = get_cmdlist(&num_cmdlist); |
| 1382 | |
| 1383 | ld->jsonrpc = tal(ld, struct jsonrpc); |
| 1384 | strmap_init(&ld->jsonrpc->cmdmap); |
| 1385 | for (size_t i=0; i<num_cmdlist; i++) { |
| 1386 | if (!jsonrpc_command_add_perm(ld, ld->jsonrpc, commands[i])) |
| 1387 | fatal("Cannot add duplicate command %s", |
| 1388 | commands[i]->name); |
| 1389 | } |
| 1390 | ld->jsonrpc->rpc_listener = NULL; |
| 1391 | tal_add_destructor(ld->jsonrpc, destroy_jsonrpc); |
| 1392 | memleak_add_helper(ld->jsonrpc, memleak_help_jsonrpc); |
| 1393 | } |
| 1394 | |
| 1395 | bool command_usage_only(const struct command *cmd) |
| 1396 | { |
no test coverage detected