| 43 | } |
| 44 | |
| 45 | static 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 | |
| 75 | static struct command_result * |
| 76 | json_peer_connected(struct command *cmd, |
nothing calls this directly
no test coverage detected