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

Function channel_cleanup_commands

lightningd/channel.c:1200–1229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1198}
1199
1200void 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
1231void channel_internal_error(struct channel *channel, const char *fmt, ...)
1232{

Callers 6

channel_disconnectFunction · 0.70
dualopen_errmsgFunction · 0.70
channel_internal_errorFunction · 0.70
peer_channels_cleanupFunction · 0.70
channel_errmsgFunction · 0.70

Calls 9

json_add_channel_idFunction · 0.85
json_add_boolFunction · 0.85
tal_freeFunction · 0.85
json_stream_successFunction · 0.70
was_pendingFunction · 0.70
command_successFunction · 0.70
command_failFunction · 0.70
json_add_stringFunction · 0.50

Tested by

no test coverage detected