Move to `Funded` after `funding_signed` rather than on funding
authorMatt Corallo <git@bluematt.me>
Thu, 30 Nov 2023 00:36:16 +0000 (00:36 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 8 Dec 2023 02:22:03 +0000 (02:22 +0000)
commit6ab56a40bebe88498dbbc42812ecc493d9553ae3
tree28c1e15eb94789bae42bd336dc7186f189ef526b
parent2d266794c2133782938ce62a96538ef138c85781
Move to `Funded` after `funding_signed` rather than on funding

Previously, channels were stored in different maps in `PeerState`
based on whether the funding had been set, keeping the keys across
the maps consistent (pre-funding temporary_channel_ids vs
funding-outpoint-based channel_ids). However, channels are now
stored in a single `channel_by_id` map, making that point moot.

Instead, here, we convert the `ChannelPhase` state transition
boundary to "once we have a `ChannelMonitor`", which makes more
sense now, and was actually the original proposed boundary.

This also requires calling `signer_maybe_unblocked` on a pre-funded
outbound channel, but that nicely also lets us limit the scope of
`FundingCreated` message generation, which we do in the next
commit.
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs