| 1175 | } |
| 1176 | |
| 1177 | static struct command_result *json_channel_open_failed(struct command *cmd, |
| 1178 | const char *buf, |
| 1179 | const jsmntok_t *params) |
| 1180 | { |
| 1181 | struct channel_id cid; |
| 1182 | struct pending_open *open; |
| 1183 | const char *err; |
| 1184 | |
| 1185 | err = json_scan(tmpctx, buf, params, |
| 1186 | "{channel_open_failed:" |
| 1187 | "{channel_id:%}}", |
| 1188 | JSON_SCAN(json_to_channel_id, &cid)); |
| 1189 | if (err) |
| 1190 | plugin_err(cmd->plugin, |
| 1191 | "`channel_open_failed` notification payload did" |
| 1192 | " not scan %s: %.*s", |
| 1193 | err, json_tok_full_len(params), |
| 1194 | json_tok_full(buf, params)); |
| 1195 | |
| 1196 | plugin_log(cmd->plugin, LOG_DBG, |
| 1197 | "Cleaning up inflight for channel_id %s", |
| 1198 | fmt_channel_id(tmpctx, &cid)); |
| 1199 | |
| 1200 | open = find_channel_pending_open(&cid); |
| 1201 | if (open) |
| 1202 | unreserve_psbt(cmd, open); |
| 1203 | |
| 1204 | /* Also clean up datastore for this channel */ |
| 1205 | return delete_channel_from_datastore(cmd, &cid); |
| 1206 | } |
| 1207 | |
| 1208 | static void json_add_policy(struct json_stream *stream, |
| 1209 | struct funder_policy *policy) |
nothing calls this directly
no test coverage detected