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

Function after_listpeerchannels

plugins/recover.c:188–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188static struct command_result *after_listpeerchannels(struct command *cmd,
189 const char *method,
190 const char *buf,
191 const jsmntok_t *params,
192 void *cb_arg UNUSED)
193{
194 const jsmntok_t *iter, *lost_statetok;
195 const jsmntok_t *channelstok = json_get_member(buf, params, "channels");
196 size_t i;
197 bool lost_state;
198
199 json_for_each_arr(i, iter, channelstok) {
200 lost_statetok = json_get_member(buf, iter, "lost_state");
201 if (lost_statetok) {
202 json_to_bool(buf, lost_statetok, &lost_state);
203
204 if (lost_state) {
205 plugin_log(plugin, LOG_DBG, "Detected a channel with lost state, Entering Recovery mode!");
206 recovery = true;
207 break;
208 }
209 }
210 }
211
212 if (recovery) {
213 entering_recovery_mode(cmd);
214 return command_still_pending(cmd);
215 }
216
217 lost_state_timer =
218 global_timer(plugin, time_from_sec(CHECK_PEER_INTERVAL),
219 do_check_lost_peer, NULL);
220 return command_still_pending(cmd);
221}
222
223static struct command_result *check_lost_peer(struct command *cmd)
224{

Callers

nothing calls this directly

Calls 6

json_get_memberFunction · 0.85
entering_recovery_modeFunction · 0.85
time_from_secFunction · 0.85
plugin_logFunction · 0.70
command_still_pendingFunction · 0.70
json_to_boolFunction · 0.50

Tested by

no test coverage detected