Don't attempt to resume channels if we already exchanged funding
authorMatt Corallo <git@bluematt.me>
Wed, 1 May 2024 14:32:47 +0000 (14:32 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 7 May 2024 21:58:52 +0000 (21:58 +0000)
commitcedd3518afbbb6777c8454df7168b32adc2b36cb
tree57a4cbd463b5281d98143694dbf35f8a7befa485
parentd1ac0717fe832bc8f439ad75c30dfe2e2012bfb3
Don't attempt to resume channels if we already exchanged funding

ddf75afd16 introduced the ability to re-exchange our `ChannelOpen`
after a peer disconnects if we didn't complete funding on our end.
It did not implement nor consider what would happen if we
re-connected after we created our own funding transactions, and
currently it panics (and even if it did not it would replay the
`FundingTransactionGenerated` event to users).

While we'd very much like to replay the `open_channel` flow even
if we have already received an `accept_channel` and funded the
channel, we cannot as the peer will likely provide different key
material in their `accept_channel`, causing us to need a different
funding transaction.

Thus, here, we simply close channels which have been funded but not
yet signed when our peer disconnects.
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs