| 332 | } |
| 333 | |
| 334 | static 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 | |
| 365 | static const char *init(struct plugin *p, |
| 366 | const char *buf UNUSED, |
nothing calls this directly
no test coverage detected