]> git.bitcoin.ninja Git - rust-lightning/commit
Fix (and test) panic when our counterparty uses a bogus funding tx 2021-04-fix-chan-shutdown-crash
authorMatt Corallo <git@bluematt.me>
Wed, 21 Apr 2021 00:11:54 +0000 (00:11 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 23 Apr 2021 22:52:43 +0000 (22:52 +0000)
commiteb42caf8a0608ab004b8d3ae179015702ea8a64d
tree1f2ec82be9cfb40a1f10096e06b55f20b01e1bcf
parente6c922803f8d1f0303dd8a8f9300e32de55e1fc9
Fix (and test) panic when our counterparty uses a bogus funding tx

During the block API refactor, we started calling
Channel::force_shutdown when a channel is closed due to a bogus
funding tx. However, we still set the channel's state to Shutdown
prior to doing so, leading to an assertion in force_shutdown (that
the channel is not already closed).

This removes the state-set call and adds a (long-overdue) test for
this case.

Fixes: 60b962a18ebcf494340ddc001870f8160c625968
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs