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

Function destroy_channel

lightningd/channel.c:64–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64static void destroy_channel(struct channel *channel)
65{
66 /* Must not have any HTLCs! */
67 struct htlc_out *hout = channel_has_htlc_out(channel);
68 struct htlc_in *hin = channel_has_htlc_in(channel);
69
70 if (hout)
71 fatal("Freeing channel %s has hout %s",
72 channel_state_name(channel),
73 htlc_state_name(hout->hstate));
74
75 if (hin)
76 fatal("Freeing channel %s has hin %s",
77 channel_state_name(channel),
78 htlc_state_name(hin->hstate));
79
80 for (size_t i = 0; i < tal_count(channel->forgets); i++)
81 was_pending(command_fail(channel->forgets[i], LIGHTNINGD,
82 "Channel structure was freed!"));
83
84 /* Free any old owner still hanging around. */
85 channel_set_owner(channel, NULL);
86
87 list_del_from(&channel->peer->channels, &channel->list);
88}
89
90void delete_channel(struct channel *channel STEALS)
91{

Callers

nothing calls this directly

Calls 9

was_pendingFunction · 0.85
channel_set_ownerFunction · 0.85
list_del_fromFunction · 0.85
channel_has_htlc_outFunction · 0.70
channel_has_htlc_inFunction · 0.70
fatalFunction · 0.70
channel_state_nameFunction · 0.70
command_failFunction · 0.70
htlc_state_nameFunction · 0.50

Tested by

no test coverage detected