Don't create chan-closed mon update for outbound never-signed chans 2020-11-dup-chan-id-crash
authorMatt Corallo <git@bluematt.me>
Mon, 23 Nov 2020 18:34:31 +0000 (13:34 -0500)
committerMatt Corallo <git@bluematt.me>
Mon, 23 Nov 2020 22:00:07 +0000 (17:00 -0500)
commit36063eeadcaf22b147303cd56f93611ec810a891
tree072e321e046a7a0e40304ad94d029cecaa5b1607
parent22de94afdde4ee6f960eedff3d6a7d01a76445ff
Don't create chan-closed mon update for outbound never-signed chans

Like the previous commit for channel-closed monitor updates for
inbound channels during processing of a funding_created message,
this resolves a more general issue for closing outbound channels
which have sent a funding_created but not yet received a
funding_signed.

This issue was also detected by full_stack_target.

To make similar issues easier to detect in testing and fuzzing, an
additional assertion is added to panic on updates to a channel
monitor before registering it.
lightning/src/chain/chainmonitor.rs
lightning/src/ln/channel.rs
lightning/src/ln/functional_tests.rs