diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp index f6d9d42f0f438..04d2e68939853 100644 --- a/src/rpc/mempool.cpp +++ b/src/rpc/mempool.cpp @@ -353,17 +353,15 @@ UniValue MempoolToJSON(const CTxMemPool& pool, bool verbose, bool include_mempoo } 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 4ad0956201350..8c0b0d702993a 100644 --- a/src/test/fuzz/tx_pool.cpp +++ b/src/test/fuzz/tx_pool.cpp @@ -101,9 +101,7 @@ void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, Cha 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 acee56fe783b3..57a86549d9a42 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -803,19 +803,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 9da51756e6084..ca842632dabf4 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -485,7 +485,6 @@ class CTxMemPool void removeForBlock(const std::vector& vtx, unsigned int nBlockHeight) EXCLUSIVE_LOCKS_REQUIRED(cs); bool CompareDepthAndScore(const uint256& hasha, const uint256& hashb, bool wtxid=false); - void queryHashes(std::vector& vtxid) const; bool isSpent(const COutPoint& outpoint) const; unsigned int GetTransactionsUpdated() const; void AddTransactionsUpdated(unsigned int n);