]> git.bitcoin.ninja Git - rust-lightning/commit
Move pre-funded-channel immediate shutdown logic to the right place
authorMatt Corallo <git@bluematt.me>
Wed, 29 Nov 2023 18:11:30 +0000 (18:11 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 8 Dec 2023 02:26:00 +0000 (02:26 +0000)
commit3a2690c8aac91e46c55060c84b41c692e18314ca
tree1e024841cadab559946b5756c9eb8c6bac10e9be
parent1667b4d20072dad58bc7252966221dfaa18f38b8
Move pre-funded-channel immediate shutdown logic to the right place

Because a `Funded` `Channel` cannot possibly be pre-funding, the
logic in `ChannelManager::close_channel_internal` to handle
pre-funding channels is in the wrong place.

Rather than being handled inside the `Funded` branch, it should be
in an `else` following it, handling either of the two
`ChannelPhases` outside of `Funded`.

Sadly, because of a previous control flow management `loop {}`, the
existing code will infinite loop, which is fixed here.
lightning/src/ln/channelmanager.rs
lightning/src/ln/shutdown_tests.rs