aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2015-10-26 14:55:17 +0100
committerJonas Schnelli <dev@jonasschnelli.ch>2015-10-26 14:58:17 +0100
commit0d699fc821048ab9316b0004e6552c8f1dc5e5f4 (patch)
tree96c6d0c6903133255916e568729a5a398d0ce032 /src/txmempool.cpp
parent867d6c90b85070644c3458e3e7ed168765523361 (diff)
fix locking issue with new mempool limiting
Current master crashes on OSX with an exception: "boost: mutex lock failed in pthread_mutex_lock: Invalid argument"
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r--src/txmempool.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index bb148005cd..efa5c8f7a3 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -309,7 +309,7 @@ void CTxMemPoolEntry::UpdateState(int64_t modifySize, CAmount modifyFee, int64_t
CTxMemPool::CTxMemPool(const CFeeRate& _minReasonableRelayFee) :
nTransactionsUpdated(0)
{
- clear();
+ _clear(); //lock free clear
// Sanity checks off by default for performance, because otherwise
// accepting transactions becomes O(N^2) where N is the number
@@ -546,9 +546,8 @@ void CTxMemPool::removeForBlock(const std::vector<CTransaction>& vtx, unsigned i
blockSinceLastRollingFeeBump = true;
}
-void CTxMemPool::clear()
+void CTxMemPool::_clear()
{
- LOCK(cs);
mapLinks.clear();
mapTx.clear();
mapNextTx.clear();
@@ -560,6 +559,12 @@ void CTxMemPool::clear()
++nTransactionsUpdated;
}
+void CTxMemPool::clear()
+{
+ LOCK(cs);
+ _clear();
+}
+
void CTxMemPool::check(const CCoinsViewCache *pcoins) const
{
if (!fSanityCheck)