diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp index 8315c6a96db3..fd7e45151ec0 100644 --- a/src/rpc/mempool.cpp +++ b/src/rpc/mempool.cpp @@ -351,17 +351,15 @@ UniValue MempoolToJSON(const CTxMemPool& pool, const llmq::CInstantSendManager* } return o; } else { + UniValue a(UniValue::VARR); uint64_t mempool_sequence; - std::vector vtxid; { LOCK(pool.cs); - pool.queryHashes(vtxid); + for (const CTxMemPoolEntry& e : pool.entryAll()) { + a.push_back(e.GetTx().GetHash().ToString()); + } mempool_sequence = pool.GetSequence(); } - UniValue a(UniValue::VARR); - for (const uint256& hash : vtxid) - a.push_back(hash.ToString()); - if (!include_mempool_sequence) { return a; } else { diff --git a/src/test/fuzz/tx_pool.cpp b/src/test/fuzz/tx_pool.cpp index aa8185cc5205..f117ae40fede 100644 --- a/src/test/fuzz/tx_pool.cpp +++ b/src/test/fuzz/tx_pool.cpp @@ -107,9 +107,7 @@ void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, con if (!info_all.empty()) { const auto& tx_to_remove = *PickValue(fuzzed_data_provider, info_all).tx; WITH_LOCK(tx_pool.cs, tx_pool.removeRecursive(tx_to_remove, MemPoolRemovalReason::BLOCK /* dummy */)); - std::vector all_txids; - tx_pool.queryHashes(all_txids); - assert(all_txids.size() < info_all.size()); + assert(tx_pool.size() < info_all.size()); WITH_LOCK(::cs_main, tx_pool.check(chainstate.CoinsTip(), chainstate.m_chain.Height() + 1)); } SyncWithValidationInterfaceQueue(); diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 64ea37992e36..ab762acb382a 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -1283,19 +1283,6 @@ std::vector CTxMemPool::Get return iters; } -void CTxMemPool::queryHashes(std::vector& vtxid) const -{ - LOCK(cs); - auto iters = GetSortedDepthAndScore(); - - vtxid.clear(); - vtxid.reserve(mapTx.size()); - - for (auto it : iters) { - vtxid.push_back(it->GetTx().GetHash()); - } -} - static TxMempoolInfo GetInfo(CTxMemPool::indexed_transaction_set::const_iterator it) { return TxMempoolInfo{it->GetSharedTx(), it->GetTime(), it->GetFee(), it->GetTxSize(), it->GetModifiedFee() - it->GetFee()}; } diff --git a/src/txmempool.h b/src/txmempool.h index d2285f1bbdf3..8de91e50e9f9 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -651,7 +651,6 @@ class CTxMemPool void clear(); void _clear() EXCLUSIVE_LOCKS_REQUIRED(cs); //lock free bool CompareDepthAndScore(const uint256& hasha, const uint256& hashb); - void queryHashes(std::vector& vtxid) const; bool isSpent(const COutPoint& outpoint) const; unsigned int GetTransactionsUpdated() const; void AddTransactionsUpdated(unsigned int n);