Release short_to_chan_info lock throughout forwarding_channel_not_found
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Mon, 16 Oct 2023 20:29:06 +0000 (13:29 -0700)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Wed, 18 Oct 2023 18:25:27 +0000 (11:25 -0700)
commited38eac1a3c685a20695c7b9ba4a2417af3a7680
tree6e219a0dcc1b430c2a672340749f5f2865a4cb1d
parent94e0ecec68d85ca1e10d08d6b35a9c9284c25ebb
Release short_to_chan_info lock throughout forwarding_channel_not_found

Not doing so caused a lock order inversion between the locks
`ChannelManager::best_block` and `ChannelManager::short_to_chan_info`
after the addition of `test_trigger_lnd_force_close`.

It turns out that we were holding the `short_to_chan_info` for longer
than needed when processing HTLC forwards. We only need to acquire it to
quickly obtain channel info, and there aren't any other locks within
`forwarding_channel_not_found` that depend on it being held.
lightning/src/ln/channelmanager.rs