Skip to content

Commit

Permalink
refactor: replace RecursiveMutex m_most_recent_block_mutex with Mutex
Browse files Browse the repository at this point in the history
In each of the critical sections, only the the guarded variables are
accessed, without any chance that within one section another one is
called.  Hence, we can use an ordinary Mutex instead of RecursiveMutex.
  • Loading branch information
theStack committed May 16, 2022
1 parent 8edd0d3 commit 83003ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ class PeerManagerImpl final : public PeerManager


// All of the following cache a recent block, and are protected by m_most_recent_block_mutex
RecursiveMutex m_most_recent_block_mutex;
Mutex m_most_recent_block_mutex;
std::shared_ptr<const CBlock> m_most_recent_block GUARDED_BY(m_most_recent_block_mutex);
std::shared_ptr<const CBlockHeaderAndShortTxIDs> m_most_recent_compact_block GUARDED_BY(m_most_recent_block_mutex);
uint256 m_most_recent_block_hash GUARDED_BY(m_most_recent_block_mutex);
Expand Down

0 comments on commit 83003ff

Please sign in to comment.