| 1212 | } |
| 1213 | |
| 1214 | static struct command_result *json_channel_open_failed(struct command *cmd, |
| 1215 | const char *buf, |
| 1216 | const jsmntok_t *params) |
| 1217 | { |
| 1218 | struct channel_id cid; |
| 1219 | struct pending_open *open; |
| 1220 | const char *err; |
| 1221 | |
| 1222 | err = json_scan(tmpctx, buf, params, |
| 1223 | "{channel_open_failed:" |
| 1224 | "{channel_id:%}}", |
| 1225 | JSON_SCAN(json_to_channel_id, &cid)); |
| 1226 | if (err) |
| 1227 | plugin_err(cmd->plugin, |
| 1228 | "`channel_open_failed` notification payload did" |
| 1229 | " not scan %s: %.*s", |
| 1230 | err, json_tok_full_len(params), |
| 1231 | json_tok_full(buf, params)); |
| 1232 | |
| 1233 | plugin_log(cmd->plugin, LOG_DBG, |
| 1234 | "Cleaning up inflight for channel_id %s", |
| 1235 | fmt_channel_id(tmpctx, &cid)); |
| 1236 | |
| 1237 | open = find_channel_pending_open(&cid); |
| 1238 | if (open) |
| 1239 | unreserve_psbt(cmd, open); |
| 1240 | |
| 1241 | /* Keep the channel's saved utxos: a failed RBF attempt also ends up |
| 1242 | * here, and the next RBF still builds on them. They're removed when |
| 1243 | * the channel leaves AWAITING_LOCKIN (json_channel_state_changed). */ |
| 1244 | return notification_handled(cmd); |
| 1245 | } |
| 1246 | |
| 1247 | static void json_add_policy(struct json_stream *stream, |
| 1248 | struct funder_policy *policy) |
nothing calls this directly
no test coverage detected