diff options
author | James O'Beirne <james.obeirne@pm.me> | 2022-09-06 19:04:45 -0400 |
---|---|---|
committer | James O'Beirne <james.obeirne@pm.me> | 2023-03-07 16:06:20 -0500 |
commit | d70919a88fc90a2662f9a844deb085d03ee7b5d8 (patch) | |
tree | 3d57fb89dada5c2f3a908c88f66fb0be4cdd95fd /src/validation.h | |
parent | 7300ced9de22e6d1bff816e6538d3370cebe7501 (diff) |
refactor: make MempoolMutex() public
for use in the following unittests.
Diffstat (limited to 'src/validation.h')
-rw-r--r-- | src/validation.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/validation.h b/src/validation.h index 9ba35b538d..d7111a7efc 100644 --- a/src/validation.h +++ b/src/validation.h @@ -748,6 +748,12 @@ public: std::string ToString() EXCLUSIVE_LOCKS_REQUIRED(::cs_main); + //! Indirection necessary to make lock annotations work with an optional mempool. + RecursiveMutex* MempoolMutex() const LOCK_RETURNED(m_mempool->cs) + { + return m_mempool ? &m_mempool->cs : nullptr; + } + private: bool ActivateBestChainStep(BlockValidationState& state, CBlockIndex* pindexMostWork, const std::shared_ptr<const CBlock>& pblock, bool& fInvalidFound, ConnectTrace& connectTrace) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool->cs); bool ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew, const std::shared_ptr<const CBlock>& pblock, ConnectTrace& connectTrace, DisconnectedBlockTransactions& disconnectpool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool->cs); @@ -761,12 +767,6 @@ private: void CheckForkWarningConditions() EXCLUSIVE_LOCKS_REQUIRED(cs_main); void InvalidChainFound(CBlockIndex* pindexNew) EXCLUSIVE_LOCKS_REQUIRED(cs_main); - //! Indirection necessary to make lock annotations work with an optional mempool. - RecursiveMutex* MempoolMutex() const LOCK_RETURNED(m_mempool->cs) - { - return m_mempool ? &m_mempool->cs : nullptr; - } - /** * Make mempool consistent after a reorg, by re-adding or recursively erasing * disconnected block transactions from the mempool, and also removing any |