Skip to content

Commit fe8c85e

Browse files
committed
mempool: Remove txiter/setEntries from public interface
1 parent 8d8bf2f commit fe8c85e

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/txmempool.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include <string_view>
3232
#include <utility>
3333

34+
using setEntries = std::set<CTxMemPool::txiter, CompareIteratorByHash>;
35+
3436
bool TestLockPointValidity(CChain& active_chain, const LockPoints& lp)
3537
{
3638
AssertLockHeld(cs_main);

src/txmempool.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,6 @@ class CTxMemPool
394394
using txiter = indexed_transaction_set::nth_index<0>::type::const_iterator;
395395
std::vector<CTransactionRef> txns_randomized GUARDED_BY(cs); //!< All transactions in mapTx, in random order
396396

397-
typedef std::set<txiter, CompareIteratorByHash> setEntries;
398-
399397
typedef std::set<CTxMemPoolEntryRef, CompareIteratorByHash> setEntryRefs;
400398

401399
using Limits = kernel::MemPoolLimits;
@@ -434,6 +432,9 @@ class CTxMemPool
434432
const Limits& limits
435433
) const EXCLUSIVE_LOCKS_REQUIRED(cs);
436434

435+
/** Returns an iterator to the given hash, if found */
436+
std::optional<txiter> GetIter(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(cs);
437+
437438
public:
438439
indirectmap<COutPoint, const CTransaction*> mapNextTx GUARDED_BY(cs);
439440
std::map<uint256, CAmount> mapDeltas GUARDED_BY(cs);
@@ -522,9 +523,6 @@ class CTxMemPool
522523
/** Get the transaction in the pool that spends the same prevout */
523524
const CTransaction* GetConflictTx(const COutPoint& prevout) const EXCLUSIVE_LOCKS_REQUIRED(cs);
524525

525-
/** Returns an iterator to the given hash, if found */
526-
std::optional<txiter> GetIter(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(cs);
527-
528526
/** Translate a set of hashes into a set of pool entries to avoid repeated lookups.
529527
* Does not require that all of the hashes correspond to actual transactions in the mempool,
530528
* only returns the ones that exist. */
@@ -688,11 +686,6 @@ class CTxMemPool
688686
const CTxMemPoolEntry* GetEntry(const Txid& txid) const LIFETIMEBOUND EXCLUSIVE_LOCKS_REQUIRED(cs);
689687

690688
CTransactionRef get(const uint256& hash) const;
691-
txiter get_iter_from_wtxid(const uint256& wtxid) const EXCLUSIVE_LOCKS_REQUIRED(cs)
692-
{
693-
AssertLockHeld(cs);
694-
return mapTx.project<0>(mapTx.get<index_by_wtxid>().find(wtxid));
695-
}
696689
TxMempoolInfo info(const GenTxid& gtxid) const;
697690

698691
/** Returns info for a transaction if its entry_sequence < last_sequence */
@@ -790,6 +783,12 @@ class CTxMemPool
790783
*/
791784
void removeUnchecked(txiter entry, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs);
792785

786+
txiter get_iter_from_wtxid(const uint256& wtxid) const EXCLUSIVE_LOCKS_REQUIRED(cs)
787+
{
788+
AssertLockHeld(cs);
789+
return mapTx.project<0>(mapTx.get<index_by_wtxid>().find(wtxid));
790+
}
791+
793792
/** visited marks a CTxMemPoolEntry as having been traversed
794793
* during the lifetime of the most recently created Epoch::Guard
795794
* and returns false if we are the first visitor, true otherwise.

0 commit comments

Comments
 (0)