Skip to content

Commit d2e46e1

Browse files
committed
Remove addScoreTxs()
1 parent 6dd4bc2 commit d2e46e1

File tree

2 files changed

+2
-64
lines changed

2 files changed

+2
-64
lines changed

src/miner.cpp

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -338,66 +338,6 @@ void BlockAssembler::AddToBlock(CTxMemPool::txiter iter)
338338
}
339339
}
340340

341-
void BlockAssembler::addScoreTxs()
342-
{
343-
std::priority_queue<CTxMemPool::txiter, std::vector<CTxMemPool::txiter>, ScoreCompare> clearedTxs;
344-
CTxMemPool::setEntries waitSet;
345-
CTxMemPool::indexed_transaction_set::index<mining_score>::type::iterator mi = mempool.mapTx.get<mining_score>().begin();
346-
CTxMemPool::txiter iter;
347-
while (!blockFinished && (mi != mempool.mapTx.get<mining_score>().end() || !clearedTxs.empty()))
348-
{
349-
// If no txs that were previously postponed are available to try
350-
// again, then try the next highest score tx
351-
if (clearedTxs.empty()) {
352-
iter = mempool.mapTx.project<0>(mi);
353-
mi++;
354-
}
355-
// If a previously postponed tx is available to try again, then it
356-
// has higher score than all untried so far txs
357-
else {
358-
iter = clearedTxs.top();
359-
clearedTxs.pop();
360-
}
361-
362-
// If tx already in block, skip (added by addPriorityTxs)
363-
if (inBlock.count(iter)) {
364-
continue;
365-
}
366-
367-
// cannot accept witness transactions into a non-witness block
368-
if (!fIncludeWitness && !iter->GetTx().wit.IsNull())
369-
continue;
370-
371-
// If tx is dependent on other mempool txs which haven't yet been included
372-
// then put it in the waitSet
373-
if (isStillDependent(iter)) {
374-
waitSet.insert(iter);
375-
continue;
376-
}
377-
378-
// If the fee rate is below the min fee rate for mining, then we're done
379-
// adding txs based on score (fee rate)
380-
if (iter->GetModifiedFee() < ::minRelayTxFee.GetFee(iter->GetTxSize()) && nBlockSize >= nBlockMinSize) {
381-
return;
382-
}
383-
384-
// If this tx fits in the block add it, otherwise keep looping
385-
if (TestForBlock(iter)) {
386-
AddToBlock(iter);
387-
388-
// This tx was successfully added, so
389-
// add transactions that depend on this one to the priority queue to try again
390-
BOOST_FOREACH(CTxMemPool::txiter child, mempool.GetMemPoolChildren(iter))
391-
{
392-
if (waitSet.count(child)) {
393-
clearedTxs.push(child);
394-
waitSet.erase(child);
395-
}
396-
}
397-
}
398-
}
399-
}
400-
401341
void BlockAssembler::UpdatePackagesForAdded(const CTxMemPool::setEntries& alreadyAdded,
402342
indexed_modified_transaction_set &mapModifiedTx)
403343
{

src/miner.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class BlockAssembler
157157
int64_t nLockTimeCutoff;
158158
const CChainParams& chainparams;
159159

160-
// Variables used for addScoreTxs and addPriorityTxs
160+
// Variables used for addPriorityTxs
161161
int lastFewTxs;
162162
bool blockFinished;
163163

@@ -174,14 +174,12 @@ class BlockAssembler
174174
void AddToBlock(CTxMemPool::txiter iter);
175175

176176
// Methods for how to add transactions to a block.
177-
/** Add transactions based on modified feerate */
178-
void addScoreTxs();
179177
/** Add transactions based on tx "priority" */
180178
void addPriorityTxs();
181179
/** Add transactions based on feerate including unconfirmed ancestors */
182180
void addPackageTxs();
183181

184-
// helper function for addScoreTxs and addPriorityTxs
182+
// helper function for addPriorityTxs
185183
/** Test if tx will still "fit" in the block */
186184
bool TestForBlock(CTxMemPool::txiter iter);
187185
/** Test if tx still has unconfirmed parents not yet in block */

0 commit comments

Comments
 (0)