Skip to content

Commit d70919a

Browse files
committed
refactor: make MempoolMutex() public
for use in the following unittests.
1 parent 7300ced commit d70919a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/validation.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,12 @@ class Chainstate
748748

749749
std::string ToString() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
750750

751+
//! Indirection necessary to make lock annotations work with an optional mempool.
752+
RecursiveMutex* MempoolMutex() const LOCK_RETURNED(m_mempool->cs)
753+
{
754+
return m_mempool ? &m_mempool->cs : nullptr;
755+
}
756+
751757
private:
752758
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);
753759
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 @@ class Chainstate
761767
void CheckForkWarningConditions() EXCLUSIVE_LOCKS_REQUIRED(cs_main);
762768
void InvalidChainFound(CBlockIndex* pindexNew) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
763769

764-
//! Indirection necessary to make lock annotations work with an optional mempool.
765-
RecursiveMutex* MempoolMutex() const LOCK_RETURNED(m_mempool->cs)
766-
{
767-
return m_mempool ? &m_mempool->cs : nullptr;
768-
}
769-
770770
/**
771771
* Make mempool consistent after a reorg, by re-adding or recursively erasing
772772
* disconnected block transactions from the mempool, and also removing any

0 commit comments

Comments
 (0)