Skip to content

Commit 01a06d6

Browse files
Avoid locking mutexes that are already held by the same thread
1 parent 07ce278 commit 01a06d6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/txmempool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ void CTxMemPool::removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMem
542542
void CTxMemPool::removeConflicts(const CTransaction &tx)
543543
{
544544
// Remove transactions which depend on inputs of tx, recursively
545-
LOCK(cs);
545+
AssertLockHeld(cs);
546546
for (const CTxIn &txin : tx.vin) {
547547
auto it = mapNextTx.find(txin.prevout);
548548
if (it != mapNextTx.end()) {

src/txmempool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ class CTxMemPool
544544

545545
void removeRecursive(const CTransaction &tx, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN);
546546
void removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight, int flags);
547-
void removeConflicts(const CTransaction &tx);
547+
void removeConflicts(const CTransaction &tx) EXCLUSIVE_LOCKS_REQUIRED(cs);
548548
void removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight);
549549

550550
void clear();

0 commit comments

Comments
 (0)