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

Function json_helloworld

tests/plugins/test_libplugin.c:45–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45static struct command_result *json_helloworld(struct command *cmd,
46 const char *buf,
47 const jsmntok_t *params)
48{
49 const char *name;
50 const char *response_buf;
51 const jsmntok_t *response;
52
53 if (!param(cmd, buf, params,
54 p_opt("name", param_string, &name),
55 NULL))
56 return command_param_failed();
57
58 plugin_notify_message(cmd, LOG_INFORM, "Notification from %s", "json_helloworld");
59
60 response = jsonrpc_request_sync(cmd, cmd, "listpeers", NULL, &response_buf);
61 plugin_log(cmd->plugin, LOG_INFORM, "listpeers gave %zu tokens: %.*s",
62 tal_count(response),
63 json_tok_full_len(response),
64 json_tok_full(response_buf, response));
65
66 if (!name)
67 return jsonrpc_get_datastore_binary(cmd,
68 mkdatastorekey(tmpctx, "test_libplugin", "name"),
69 get_ds_bin_done,
70 "hello");
71
72 return command_success(cmd, json_out_obj(cmd, "hello", name));
73}
74
75static struct command_result *
76json_peer_connected(struct command *cmd,

Callers

nothing calls this directly

Calls 9

paramFunction · 0.50
command_param_failedFunction · 0.50
plugin_notify_messageFunction · 0.50
jsonrpc_request_syncFunction · 0.50
plugin_logFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50
command_successFunction · 0.50
json_out_objFunction · 0.50

Tested by

no test coverage detected