aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <[email protected]>2018-07-22 09:41:34 -0400
committerMarcoFalke <[email protected]>2018-07-22 09:41:36 -0400
commit05714f96e4a63aa222cf7b233434de4a0b036d9d (patch)
tree41c93cda77b88bcb0173fc5b5d12b7c6829ecf78 /src
parentMerge #12764: doc: Remove field in getblocktemplate help that has never been ... (diff)
parentAvoid locking mutexes that are already held by the same thread (diff)
downloaddiscoin-05714f96e4a63aa222cf7b233434de4a0b036d9d.tar.xz
discoin-05714f96e4a63aa222cf7b233434de4a0b036d9d.zip
Merge #11762: Avoid locking mutexes that are already held by the same thread
01a06d6686 Avoid locking mutexes that are already held by the same thread (practicalswift) Pull request description: Avoid locking mutexes that are already held by the same thread. These are reentrant mutexes, but still no need to lock them more than once per thread :-) Tree-SHA512: e2fb85882e8800892fd8e8170f3c13128d6acfeb14d7b69fb9555f2b7ad0884fb201cf945b8144ffaf6fb1253c28af7c8c6c435319a7ae30ca003f28aa645a98
Diffstat (limited to 'src')
-rw-r--r--src/txmempool.cpp2
-rw-r--r--src/txmempool.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 1db006ecd..d579f131c 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -542,7 +542,7 @@ void CTxMemPool::removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMem
void CTxMemPool::removeConflicts(const CTransaction &tx)
{
// Remove transactions which depend on inputs of tx, recursively
- LOCK(cs);
+ AssertLockHeld(cs);
for (const CTxIn &txin : tx.vin) {
auto it = mapNextTx.find(txin.prevout);
if (it != mapNextTx.end()) {
diff --git a/src/txmempool.h b/src/txmempool.h
index ebfcf36e1..784d5453b 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -544,7 +544,7 @@ public:
void removeRecursive(const CTransaction &tx, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN);
void removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight, int flags);
- void removeConflicts(const CTransaction &tx);
+ void removeConflicts(const CTransaction &tx) EXCLUSIVE_LOCKS_REQUIRED(cs);
void removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight);
void clear();