Skip to content

Commit 9501dc2

Browse files
committed
Merge #12127: Remove unused mempool index
8e617e3 Remove unused mempool index (Suhas Daftuar) Pull request description: We haven't used the "mining_score" index since 0.12, so remove it. Tree-SHA512: ae37b8663194986eaeecfc2bbeca7ecb4ae6f0d8384515fa218cbc939a580d4b9f7f997c5297c3f1b3c3a0651edb092f373ac9a4808aaec30d38cb99d5f3ed70
2 parents 45cf8a0 + 8e617e3 commit 9501dc2

File tree

3 files changed

+2
-39
lines changed

3 files changed

+2
-39
lines changed

src/test/mempool_tests.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -287,35 +287,6 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
287287

288288
pool.removeRecursive(pool.mapTx.find(tx9.GetHash())->GetTx());
289289
pool.removeRecursive(pool.mapTx.find(tx8.GetHash())->GetTx());
290-
/* Now check the sort on the mining score index.
291-
* Final order should be:
292-
*
293-
* tx7 (2M)
294-
* tx2 (20k)
295-
* tx4 (15000)
296-
* tx1/tx5 (10000)
297-
* tx3/6 (0)
298-
* (Ties resolved by hash)
299-
*/
300-
sortedOrder.clear();
301-
sortedOrder.push_back(tx7.GetHash().ToString());
302-
sortedOrder.push_back(tx2.GetHash().ToString());
303-
sortedOrder.push_back(tx4.GetHash().ToString());
304-
if (tx1.GetHash() < tx5.GetHash()) {
305-
sortedOrder.push_back(tx5.GetHash().ToString());
306-
sortedOrder.push_back(tx1.GetHash().ToString());
307-
} else {
308-
sortedOrder.push_back(tx1.GetHash().ToString());
309-
sortedOrder.push_back(tx5.GetHash().ToString());
310-
}
311-
if (tx3.GetHash() < tx6.GetHash()) {
312-
sortedOrder.push_back(tx6.GetHash().ToString());
313-
sortedOrder.push_back(tx3.GetHash().ToString());
314-
} else {
315-
sortedOrder.push_back(tx3.GetHash().ToString());
316-
sortedOrder.push_back(tx6.GetHash().ToString());
317-
}
318-
CheckSort<mining_score>(pool, sortedOrder);
319290
}
320291

321292
BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)

src/txmempool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,8 @@ bool CCoinsViewMemPool::GetCoin(const COutPoint &outpoint, Coin &coin) const {
906906

907907
size_t CTxMemPool::DynamicMemoryUsage() const {
908908
LOCK(cs);
909-
// Estimate the overhead of mapTx to be 15 pointers + an allocation, as no exact formula for boost::multi_index_contained is implemented.
910-
return memusage::MallocUsage(sizeof(CTxMemPoolEntry) + 15 * sizeof(void*)) * mapTx.size() + memusage::DynamicUsage(mapNextTx) + memusage::DynamicUsage(mapDeltas) + memusage::DynamicUsage(mapLinks) + memusage::DynamicUsage(vTxHashes) + cachedInnerUsage;
909+
// Estimate the overhead of mapTx to be 12 pointers + an allocation, as no exact formula for boost::multi_index_contained is implemented.
910+
return memusage::MallocUsage(sizeof(CTxMemPoolEntry) + 12 * sizeof(void*)) * mapTx.size() + memusage::DynamicUsage(mapNextTx) + memusage::DynamicUsage(mapDeltas) + memusage::DynamicUsage(mapLinks) + memusage::DynamicUsage(vTxHashes) + cachedInnerUsage;
911911
}
912912

913913
void CTxMemPool::RemoveStaged(setEntries &stage, bool updateDescendants, MemPoolRemovalReason reason) {

src/txmempool.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ class CompareTxMemPoolEntryByAncestorFee
287287
// Multi_index tag names
288288
struct descendant_score {};
289289
struct entry_time {};
290-
struct mining_score {};
291290
struct ancestor_score {};
292291

293292
class CBlockPolicyEstimator;
@@ -356,7 +355,6 @@ class SaltedTxidHasher
356355
* - transaction hash
357356
* - feerate [we use max(feerate of tx, feerate of tx with all descendants)]
358357
* - time in mempool
359-
* - mining score (feerate modified by any fee deltas from PrioritiseTransaction)
360358
*
361359
* Note: the term "descendant" refers to in-mempool transactions that depend on
362360
* this one, while "ancestor" refers to in-mempool transactions that a given
@@ -446,12 +444,6 @@ class CTxMemPool
446444
boost::multi_index::identity<CTxMemPoolEntry>,
447445
CompareTxMemPoolEntryByEntryTime
448446
>,
449-
// sorted by score (for mining prioritization)
450-
boost::multi_index::ordered_unique<
451-
boost::multi_index::tag<mining_score>,
452-
boost::multi_index::identity<CTxMemPoolEntry>,
453-
CompareTxMemPoolEntryByScore
454-
>,
455447
// sorted by fee rate with ancestors
456448
boost::multi_index::ordered_non_unique<
457449
boost::multi_index::tag<ancestor_score>,

0 commit comments

Comments
 (0)