CTxMemPool::queryHashes()
is only used in MempoolToJSON()
, where it can just as easily be replaced with the more general CTxMemPool::entryAll()
. No behaviour change, just cleans up the code.
CTxMemPool::queryHashes()
is only used in MempoolToJSON()
, where it can just as easily be replaced with the more general CTxMemPool::entryAll()
. No behaviour change, just cleans up the code.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For detailed information about the code coverage, see the test coverage report.
See the guideline for information on the review process.
Type | Reviewers |
---|---|
ACK | dergoegge, TheCharlatan, glozow |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
100@@ -101,9 +101,6 @@ void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, Cha
101 if (!info_all.empty()) {
102 const auto& tx_to_remove = *PickValue(fuzzed_data_provider, info_all).tx;
103 WITH_LOCK(tx_pool.cs, tx_pool.removeRecursive(tx_to_remove, MemPoolRemovalReason::BLOCK /* dummy */));
104- std::vector<uint256> all_txids;
105- tx_pool.queryHashes(all_txids);
106- assert(all_txids.size() < info_all.size());
Sorry, I misunderstood the test. Replaced now with:
0 assert(tx_pool.size() < info_all.size());
360 LOCK(pool.cs);
361- pool.queryHashes(vtxid);
362+ for (const CTxMemPoolEntry& e : pool.entryAll()) {
363+ a.push_back(e.GetTx().GetHash().ToString());
364+ }
365 mempool_sequence = pool.GetSequence();
infoAll
since that doesn’t require the lock externally but we need the sequence to be in sync so we can’t, oh well…
entryAll
returning just refs has less overhead than infoAll
so I think regardless this is a preferred approach? (even if it’s not a huge difference)
That overhead is tiny if any, I’d think. You can benchmark MempoolToJSON and it’d bet it won’t even show up. But anyway we can’t use it due to the sequence sync requirement.
Actually, maybe it’s worth considering removing entryAll
too? it’s only used in two places and we can work around the sync issue somehow, but not in this PR…
Its only usage can easily be replaced with CTxMemPool::entryAll()
100@@ -101,9 +101,8 @@ void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, Cha
101 if (!info_all.empty()) {
102 const auto& tx_to_remove = *PickValue(fuzzed_data_provider, info_all).tx;
103 WITH_LOCK(tx_pool.cs, tx_pool.removeRecursive(tx_to_remove, MemPoolRemovalReason::BLOCK /* dummy */));
104- std::vector<uint256> all_txids;
105- tx_pool.queryHashes(all_txids);
106- assert(all_txids.size() < info_all.size());
107+ const auto new_size{WITH_LOCK(tx_pool.cs, return tx_pool.entryAll().size())};
infoAll
to avoid the WITH_LOCK
?
tx_pool.size()
option too, using that now.