From 01a06d66869054dc94ffc1c02515f27873087b90 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Thu, 22 Feb 2018 22:16:54 +0100 Subject: [PATCH] Avoid locking mutexes that are already held by the same thread --- src/txmempool.cpp | 2 +- src/txmempool.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 8090172e3..56f9f34c9 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& vtx, unsigned int nBlockHeight); void clear();