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

Function channel_cleanup_commands

lightningd/channel.c:870–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

868}
869
870void channel_cleanup_commands(struct channel *channel, const char *why)
871{
872 if (channel->open_attempt) {
873 struct open_attempt *oa = channel->open_attempt;
874 if (oa->cmd) {
875 /* If we requested this be aborted, it's a success */
876 if (oa->aborted) {
877 struct json_stream *response;
878 response = json_stream_success(oa->cmd);
879 json_add_channel_id(response,
880 "channel_id",
881 &channel->cid);
882 json_add_bool(response, "channel_canceled",
883 list_empty(&channel->inflights));
884 json_add_string(response, "reason", why);
885 was_pending(command_success(oa->cmd, response));
886 } else
887 was_pending(command_fail(oa->cmd, LIGHTNINGD,
888 "%s", why));
889 }
890 notify_channel_open_failed(channel->peer->ld, &channel->cid);
891 channel->open_attempt = tal_free(channel->open_attempt);
892 }
893
894 if (channel->openchannel_signed_cmd) {
895 was_pending(command_fail(channel->openchannel_signed_cmd,
896 LIGHTNINGD, "%s", why));
897 channel->openchannel_signed_cmd = NULL;
898 }
899}
900
901void channel_internal_error(struct channel *channel, const char *fmt, ...)
902{

Callers 5

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

Calls 9

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

Tested by

no test coverage detected