diff options
author | TheCharlatan <seb.kung@gmail.com> | 2023-11-02 15:50:45 +0100 |
---|---|---|
committer | TheCharlatan <seb.kung@gmail.com> | 2023-11-10 16:44:25 +0100 |
commit | 1c6a73abbd1fb773c7d0036beb952b95dde8e38b (patch) | |
tree | 7542c715b3f35f3a2696f858919767e8830d1ff1 /src/txmempool.cpp | |
parent | 453b4813ebc74859864803e9972b58e4be76a4d6 (diff) | |
download | bitcoin-1c6a73abbd1fb773c7d0036beb952b95dde8e38b.tar.xz |
[refactor] Add helper for retrieving mempool entry
In places where the iterator is only needed for accessing the actual
entry, it should not be required to first retrieve the iterator.
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r-- | src/txmempool.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 8b744698ba..e39f897544 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -862,6 +862,13 @@ std::vector<TxMempoolInfo> CTxMemPool::infoAll() const return ret; } +const CTxMemPoolEntry* CTxMemPool::GetEntry(const Txid& txid) const +{ + AssertLockHeld(cs); + const auto i = mapTx.find(txid); + return i == mapTx.end() ? nullptr : &(*i); +} + CTransactionRef CTxMemPool::get(const uint256& hash) const { LOCK(cs); |