Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/rpc/mempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint256> 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 {
Expand Down
4 changes: 1 addition & 3 deletions src/test/fuzz/tx_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint256> 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();
Expand Down
13 changes: 0 additions & 13 deletions src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1283,19 +1283,6 @@ std::vector<CTxMemPool::indexed_transaction_set::const_iterator> CTxMemPool::Get
return iters;
}

void CTxMemPool::queryHashes(std::vector<uint256>& 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()};
}
Expand Down
1 change: 0 additions & 1 deletion src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint256>& vtxid) const;
bool isSpent(const COutPoint& outpoint) const;
unsigned int GetTransactionsUpdated() const;
void AddTransactionsUpdated(unsigned int n);
Expand Down
Loading