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

Function json_state_changed

plugins/chanbackup.c:334–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334static struct command_result *json_state_changed(struct command *cmd,
335 const char *buf,
336 const jsmntok_t *params)
337{
338 const jsmntok_t *notiftok = json_get_member(buf,
339 params,
340 "channel_state_changed"),
341 *statetok = json_get_member(buf, notiftok, "new_state");
342
343 /* FIXME: I wanted to update the file on CHANNELD_AWAITING_LOCKIN,
344 * But I don't get update for it, maybe because there is
345 * no previous_state, also apparently `channel_opened` gets published
346 * when *peer* funded a channel with us?
347 * So, is their no way to get a notif on CHANNELD_AWAITING_LOCKIN? */
348 if (json_tok_streq(buf, statetok, "CLOSED") ||
349 json_tok_streq(buf, statetok, "CHANNELD_NORMAL")) {
350
351 struct out_req *req;
352 req = jsonrpc_request_start(cmd->plugin,
353 cmd,
354 "staticbackup",
355 after_staticbackup,
356 &forward_error,
357 NULL);
358
359 return send_outreq(cmd->plugin, req);
360 }
361
362 return notification_handled(cmd);
363}
364
365static const char *init(struct plugin *p,
366 const char *buf UNUSED,

Callers

nothing calls this directly

Calls 4

notification_handledFunction · 0.85
send_outreqFunction · 0.70
json_get_memberFunction · 0.50
json_tok_streqFunction · 0.50

Tested by

no test coverage detected