| 109 | |
| 110 | |
| 111 | static struct command_result *do_check_gossip(struct command *cmd, void *unused) |
| 112 | { |
| 113 | find_exes_timer = NULL; |
| 114 | |
| 115 | gossmap_refresh(global_gossmap); |
| 116 | |
| 117 | plugin_log(plugin, LOG_DBG, "Finding our node in gossip"); |
| 118 | |
| 119 | struct gossmap_node *n = gossmap_find_node(global_gossmap, &local_id); |
| 120 | |
| 121 | if (n) { |
| 122 | for (size_t i = 0; i < n->num_chans; i++) { |
| 123 | int half; |
| 124 | struct node_id peer_id; |
| 125 | struct gossmap_chan *c = gossmap_nth_chan(global_gossmap, n, i, &half); |
| 126 | struct gossmap_node *neighbour = gossmap_nth_node(global_gossmap, c, !half); |
| 127 | |
| 128 | gossmap_node_get_id(global_gossmap, neighbour, &peer_id); |
| 129 | |
| 130 | struct out_req *req; |
| 131 | req = jsonrpc_request_start(cmd, |
| 132 | "connect", |
| 133 | connect_success, |
| 134 | connect_fail, |
| 135 | NULL); |
| 136 | |
| 137 | json_add_node_id(req->js, "id", &peer_id); |
| 138 | |
| 139 | plugin_log(plugin, LOG_DBG, "Connecting to: %s", |
| 140 | fmt_node_id(tmpctx, &peer_id)); |
| 141 | send_outreq(req); |
| 142 | |
| 143 | } |
| 144 | |
| 145 | peer_storage_timer = |
| 146 | global_timer(plugin, |
| 147 | time_from_sec(CHECK_STORAGE_INTERVAL), |
| 148 | do_find_peer_storage, NULL); |
| 149 | return timer_complete(cmd); |
| 150 | } |
| 151 | |
| 152 | find_exes_timer = global_timer( |
| 153 | plugin, time_from_sec(CHECK_PEER_INTERVAL), do_check_gossip, NULL); |
| 154 | return timer_complete(cmd); |
| 155 | } |
| 156 | |
| 157 | static void entering_recovery_mode(struct command *cmd) |
| 158 | { |
nothing calls this directly
no test coverage detected