| 1198 | } |
| 1199 | |
| 1200 | void channel_cleanup_commands(struct channel *channel, const char *why) |
| 1201 | { |
| 1202 | if (channel->open_attempt) { |
| 1203 | struct open_attempt *oa = channel->open_attempt; |
| 1204 | if (oa->cmd) { |
| 1205 | /* If we requested this be aborted, it's a success */ |
| 1206 | if (oa->aborted) { |
| 1207 | struct json_stream *response; |
| 1208 | response = json_stream_success(oa->cmd); |
| 1209 | json_add_channel_id(response, |
| 1210 | "channel_id", |
| 1211 | &channel->cid); |
| 1212 | json_add_bool(response, "channel_canceled", |
| 1213 | list_empty(&channel->inflights)); |
| 1214 | json_add_string(response, "reason", why); |
| 1215 | was_pending(command_success(oa->cmd, response)); |
| 1216 | } else |
| 1217 | was_pending(command_fail(oa->cmd, LIGHTNINGD, |
| 1218 | "%s", why)); |
| 1219 | } |
| 1220 | notify_channel_open_failed(channel->peer->ld, &channel->cid); |
| 1221 | channel->open_attempt = tal_free(channel->open_attempt); |
| 1222 | } |
| 1223 | |
| 1224 | if (channel->openchannel_signed_cmd) { |
| 1225 | was_pending(command_fail(channel->openchannel_signed_cmd, |
| 1226 | LIGHTNINGD, "%s", why)); |
| 1227 | channel->openchannel_signed_cmd = NULL; |
| 1228 | } |
| 1229 | } |
| 1230 | |
| 1231 | void channel_internal_error(struct channel *channel, const char *fmt, ...) |
| 1232 | { |
no test coverage detected