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