topology tells us if it's a known node by returning details. */
| 123 | |
| 124 | /* topology tells us if it's a known node by returning details. */ |
| 125 | static void listnodes_done(const char *buffer, |
| 126 | const jsmntok_t *toks, |
| 127 | const jsmntok_t *idtok UNUSED, |
| 128 | struct command_and_node *can) |
| 129 | { |
| 130 | struct json_stream *response; |
| 131 | const jsmntok_t *t; |
| 132 | |
| 133 | t = json_get_member(buffer, toks, "result"); |
| 134 | if (t) |
| 135 | t = json_get_member(buffer, t, "nodes"); |
| 136 | |
| 137 | if (!deprecated_apis && (!t || t->size == 0)) { |
| 138 | response = json_stream_fail(can->cmd, SIGNMESSAGE_PUBKEY_NOT_FOUND, |
| 139 | "pubkey not found in the graph"); |
| 140 | json_add_node_id(response, "claimed_key", &can->id); |
| 141 | json_object_end(response); |
| 142 | was_pending(command_failed(can->cmd, response)); |
| 143 | return; |
| 144 | } |
| 145 | response = json_stream_success(can->cmd); |
| 146 | json_add_node_id(response, "pubkey", &can->id); |
| 147 | json_add_bool(response, "verified", t && t->size == 1); |
| 148 | was_pending(command_success(can->cmd, response)); |
| 149 | } |
| 150 | |
| 151 | static struct command_result *json_checkmessage(struct command *cmd, |
| 152 | const char *buffer, |
nothing calls this directly
no test coverage detected