| 62 | } |
| 63 | |
| 64 | static 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 | |
| 90 | void delete_channel(struct channel *channel STEALS) |
| 91 | { |
nothing calls this directly
no test coverage detected