Fix handling of duplicate initial `ChannelMonitor` writing 2023-12-closing-event-cleanup-fixes
authorMatt Corallo <git@bluematt.me>
Mon, 25 Dec 2023 06:55:08 +0000 (06:55 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 29 Dec 2023 06:27:31 +0000 (06:27 +0000)
commit7bc2a148b2525913c9c6e70fe15449fe4835ff2e
treef8f06aced3f4a08d048dcb9742d24fc8ab1c41ef
parent5eea3058c921aa4c0739dc10565ee8d236302274
Fix handling of duplicate initial `ChannelMonitor` writing

In e06484b0f44155e647ff29810d2f187967e45813, we added specific
handling for outbound-channel initial monitor updates failing -
in such a case we have a counterparty who tried to open a second
channel with the same funding info we just gave them, causing us
to force-close our outbound channel as it shows up as
duplicate-funding. Its largely harmless as it leads to a spurious
force-closure of a channel with a peer doing something absurd,
however it causes the `full_stack_target` fuzzer to fail.

Sadly, in 574c77e7bc95fd8dea5a8058b6b35996cc99db8d, as we were
dropping handling of `PermanentFailure` handling for updates, we
accidentally dropped handling for initial updates as well.

Here we fix the issue (again) and add a test.
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs