aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-09-10 18:19:02 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-09-10 18:32:00 +0200
commite0a4f9de7fbb675dcc7207f91b60b66f14dc227a (patch)
tree9114fd91d68206ce0079ce6b81b21dd063990dbe /src/txmempool.h
parent838b85e120fd7957cf4abce0905d3aff96fa7278 (diff)
parentfaa1a749428a195af784633eb78e1df5d6a0e875 (diff)
Merge #13793: tx pool: Use class methods to hide raw map iterator impl details
faa1a749428a195af784633eb78e1df5d6a0e875 tx pool: Use class methods to hide raw map iterator impl details (MarcoFalke) Pull request description: ATMP et al would often use map iterator implementation details such as `end()` or `find()`, which is acceptable in current code. However, this not only makes it impossible to turn the maps into private members in the future but also makes it harder to replace the maps with different data structures. This is required for and split off of #13804 Tree-SHA512: 4f9017fd1d98d9df49d25bba92655a4a97755eea161fd1cbb565ceb81bbc2b4924129d214f8a29563a77e3d8eef85a67c81245ecdc9a9e5292d419922a93cb88
Diffstat (limited to 'src/txmempool.h')
-rw-r--r--src/txmempool.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/txmempool.h b/src/txmempool.h
index 2163b5eb21..913501fd66 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -566,7 +566,15 @@ public:
void ApplyDelta(const uint256 hash, CAmount &nFeeDelta) const;
void ClearPrioritisation(const uint256 hash);
-public:
+ /** Get the transaction in the pool that spends the same prevout */
+ const CTransaction* GetConflictTx(const COutPoint& prevout) const EXCLUSIVE_LOCKS_REQUIRED(cs);
+
+ /** Returns an iterator to the given hash, if found */
+ boost::optional<txiter> GetIter(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(cs);
+
+ /** Translate a set of hashes into a set of pool iterators to avoid repeated lookups */
+ setEntries GetIterSet(const std::set<uint256>& hashes) const EXCLUSIVE_LOCKS_REQUIRED(cs);
+
/** Remove a set of transactions from the mempool.
* If a transaction is in this set, then all in-mempool descendants must
* also be in the set, unless this transaction is being removed for being
@@ -639,7 +647,7 @@ public:
return totalTxSize;
}
- bool exists(uint256 hash) const
+ bool exists(const uint256& hash) const
{
LOCK(cs);
return (mapTx.count(hash) != 0);