diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-12-15 11:25:05 +1300 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-12-20 08:13:50 +1300 |
commit | fa5c346c5a336ccdce8e50befb53746c280f053e (patch) | |
tree | 0d5a7478695a449bae42c14a4e2546678a3ecbcc /src/validation.cpp | |
parent | fafe941bdd4572b5b9200457a2267888d7efd9bb (diff) |
doc: Add comment to cs_main and mempool::cs
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 5696684ed6..25818e496d 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -210,9 +210,17 @@ private: bool RollforwardBlock(const CBlockIndex* pindex, CCoinsViewCache& inputs, const CChainParams& params) EXCLUSIVE_LOCKS_REQUIRED(cs_main); } g_chainstate; - - -CCriticalSection cs_main; +/** + * Mutex to guard access to validation specific variables, such as reading + * or changing the chainstate. + * + * This may also need to be locked when updating the transaction pool, e.g. on + * AcceptToMemoryPool. See CTxMemPool::cs comment for details. + * + * The transaction pool has a separate lock to allow reading from it and the + * chainstate at the same time. + */ +RecursiveMutex cs_main; BlockMap& mapBlockIndex = g_chainstate.mapBlockIndex; CChain& chainActive = g_chainstate.chainActive; |