Move ChannelClosed generation into finish_close_channel
authorMatt Corallo <git@bluematt.me>
Fri, 29 Dec 2023 03:23:59 +0000 (03:23 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 29 Dec 2023 06:27:31 +0000 (06:27 +0000)
commit080865dff975a57cc9b88a7678eee2f963847bc4
treea77c2014ada0480bc0b3ba6d0f11322269aade82
parentee5b8c7003af296bc8189b0b6075889a106513c5
Move ChannelClosed generation into finish_close_channel

Currently the channel shutdown sequence has a number of steps which
all the shutdown callsites have to call. Because many shutdown
cases are rare error cases, its relatively easy to miss a call and
leave users without `Event`s or miss some important cleanup.

One of those steps, calling `issue_channel_close_events`, is rather
easy to remove, as it only generates two events, which can simply
be moved to another shutdown step.

Here we remove `issue_channel_close_events` by moving
`ChannelClosed` event generation into `finish_force_close_channel`.
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs