]> git.bitcoin.ninja Git - rust-lightning/commit
Order ChannelManager lock acquisition
authorJeffrey Czyz <jkczyz@gmail.com>
Thu, 4 Mar 2021 03:21:16 +0000 (19:21 -0800)
committerJeffrey Czyz <jkczyz@gmail.com>
Fri, 5 Mar 2021 03:08:42 +0000 (19:08 -0800)
commit1c948a57666bc0d2b6e9ac4926df2ed655741227
treedf56d785d968732615b35a976279dd77d296d220
parent81131a0b2709cc8456378825052472dbb2947534
Order ChannelManager lock acquisition

Since last_block_hash is read while updating channels and written when
blocks are connected and disconnected, its lock should be held for the
duration of these operations. Further, since the channel_state lock is
already held during these operations, an ordering of lock acquisition
should be maintained to enforce consistency.

Ordering lock acquisition such that channel_state is held for the
duration of last_block_hash gives a consistent ordering.
lightning/src/ln/channelmanager.rs