Skip to content

Commit 7140b31

Browse files
committed
refactor: CTxMemPool::ApplyDelta() requires CTxMemPool::cs lock
No change in behavior, the lock is already held at call sites. Also `const uint256` refactored to `const uint256&`.
1 parent 66e47e5 commit 7140b31

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/txmempool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,9 +852,9 @@ void CTxMemPool::PrioritiseTransaction(const uint256& hash, const CAmount& nFeeD
852852
LogPrintf("PrioritiseTransaction: %s feerate += %s\n", hash.ToString(), FormatMoney(nFeeDelta));
853853
}
854854

855-
void CTxMemPool::ApplyDelta(const uint256 hash, CAmount &nFeeDelta) const
855+
void CTxMemPool::ApplyDelta(const uint256& hash, CAmount &nFeeDelta) const
856856
{
857-
LOCK(cs);
857+
AssertLockHeld(cs);
858858
std::map<uint256, CAmount>::const_iterator pos = mapDeltas.find(hash);
859859
if (pos == mapDeltas.end())
860860
return;

src/txmempool.h

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

627627
/** Affect CreateNewBlock prioritisation of transactions */
628628
void PrioritiseTransaction(const uint256& hash, const CAmount& nFeeDelta);
629-
void ApplyDelta(const uint256 hash, CAmount &nFeeDelta) const;
629+
void ApplyDelta(const uint256& hash, CAmount &nFeeDelta) const EXCLUSIVE_LOCKS_REQUIRED(cs);
630630
void ClearPrioritisation(const uint256 hash);
631631

632632
/** Get the transaction in the pool that spends the same prevout */

0 commit comments

Comments
 (0)