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

Function destroy_channel

lightningd/channel.c:62–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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
was_pendingFunction · 0.70
command_failFunction · 0.70
htlc_state_nameFunction · 0.50

Tested by

no test coverage detected