From 939807768acd508932f2efabee660d56324a73df Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 1 Sep 2020 12:12:47 +0300 Subject: [PATCH] refactor: CTxMemPool::UpdateParent() requires CTxMemPool::cs lock No change in behavior, the lock is already held at call sites. --- src/txmempool.cpp | 1 + src/txmempool.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index de1a3ec68f2..ef2ec661e87 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -978,6 +978,7 @@ void CTxMemPool::UpdateChild(txiter entry, txiter child, bool add) void CTxMemPool::UpdateParent(txiter entry, txiter parent, bool add) { + AssertLockHeld(cs); setEntries s; if (add && mapLinks[entry].parents.insert(parent).second) { cachedInnerUsage += memusage::IncrementalDynamicUsage(s); diff --git a/src/txmempool.h b/src/txmempool.h index 4743e1b63ac..fbff1afcca3 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -568,7 +568,7 @@ private: typedef std::map txlinksMap; txlinksMap mapLinks; - void UpdateParent(txiter entry, txiter parent, bool add); + void UpdateParent(txiter entry, txiter parent, bool add) EXCLUSIVE_LOCKS_REQUIRED(cs); void UpdateChild(txiter entry, txiter child, bool add); std::vector GetSortedDepthAndScore() const EXCLUSIVE_LOCKS_REQUIRED(cs);