Don't attempt to resume channels if we already exchanged funding 2024-04-2982-123-fix
authorMatt Corallo <git@bluematt.me>
Wed, 1 May 2024 14:32:47 +0000 (14:32 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 28 May 2024 15:34:46 +0000 (15:34 +0000)
commit53cd31a2ece2e3abb04d649de8d63716de2dae65
tree230f8be5cc503b527030de5130cc2729985826ee
parent1d421d3362a88105b982d197312c0c64ba8e661e
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