Construct all ChannelMonitor mutexes in the same function
authorMatt Corallo <git@bluematt.me>
Fri, 15 Jul 2022 16:18:42 +0000 (16:18 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 20 Jul 2022 22:08:59 +0000 (22:08 +0000)
commit625cda108c9f5be5443e8c42007bb987261c5270
treea97de272eae7b6756a944ce2150b2179a2b1cf23
parent0627c0c88a6672b6813b7b277dc925b8bf7cab49
Construct all ChannelMonitor mutexes in the same function

When we add lockorder detection based on mutex construction site
rather than mutex instance in the next commit, ChannelMonitor's
PartialEq implementation causes spurious failures. This is caused
by the lockorder detection logic considering the ChannelMonitor
inner mutex to be two distinct mutexes - one when monitors are
deserialized and one when monitors are created fresh. Instead, we
attempt to tell the lockorder detection logic that they are the
same by ensuring they're constructed in the same place - in this
case a util method.
lightning/src/chain/channelmonitor.rs