diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2017-11-14 23:35:42 +0100 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2018-05-05 16:50:58 +0200 |
commit | 6bc5b7100b1182c4c060c045df9a58dada3d3eab (patch) | |
tree | 6b2514ac576d238d3d966f170167286528e1b5cc | |
parent | 66cc47be982aa431b72494f5d655c20eea17a0f5 (diff) |
Fix missing locking in CTxMemPool::check(const CCoinsViewCache *pcoins)
* reading variable 'mapTx' requires holding mutex 'cs'
* reading variable 'mapNextTx' requires holding mutex 'cs'
* reading variable 'nCheckFrequency' requires holding mutex 'cs'
-rw-r--r-- | src/txmempool.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index d03429ca81..bb585fc075 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -618,6 +618,7 @@ static void CheckInputsAndUpdateCoins(const CTransaction& tx, CCoinsViewCache& m void CTxMemPool::check(const CCoinsViewCache *pcoins) const { + LOCK(cs); if (nCheckFrequency == 0) return; @@ -632,7 +633,6 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const CCoinsViewCache mempoolDuplicate(const_cast<CCoinsViewCache*>(pcoins)); const int64_t spendheight = GetSpendHeight(mempoolDuplicate); - LOCK(cs); std::list<const CTxMemPoolEntry*> waitingOnDependants; for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) { unsigned int i = 0; |