@@ -262,23 +262,6 @@ int BlockAssembler::UpdatePackagesForAdded(const CTxMemPool::setEntries& already
262262 return nDescendantsUpdated;
263263}
264264
265- // Skip entries in mapTx that are already in a block or are present
266- // in mapModifiedTx (which implies that the mapTx ancestor state is
267- // stale due to ancestor inclusion in the block)
268- // Also skip transactions that we've already failed to add. This can happen if
269- // we consider a transaction in mapModifiedTx and it fails: we can then
270- // potentially consider it again while walking mapTx. It's currently
271- // guaranteed to fail again, but as a belt-and-suspenders check we put it in
272- // failedTx and avoid re-evaluation, since the re-evaluation would be using
273- // cached size/sigops/fee values that are not actually correct.
274- bool BlockAssembler::SkipMapTxEntry (CTxMemPool::txiter it, indexed_modified_transaction_set& mapModifiedTx, CTxMemPool::setEntries& failedTx)
275- {
276- AssertLockHeld (m_mempool.cs );
277-
278- assert (it != m_mempool.mapTx .end ());
279- return mapModifiedTx.count (it) || inBlock.count (it) || failedTx.count (it);
280- }
281-
282265void BlockAssembler::SortForBlock (const CTxMemPool::setEntries& package, std::vector<CTxMemPool::txiter>& sortedEntries)
283266{
284267 // Sort package by ancestor count
@@ -321,10 +304,25 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
321304
322305 while (mi != m_mempool.mapTx .get <ancestor_score>().end () || !mapModifiedTx.empty ()) {
323306 // First try to find a new transaction in mapTx to evaluate.
324- if (mi != m_mempool.mapTx .get <ancestor_score>().end () &&
325- SkipMapTxEntry (m_mempool.mapTx .project <0 >(mi), mapModifiedTx, failedTx)) {
326- ++mi;
327- continue ;
307+ //
308+ // Skip entries in mapTx that are already in a block or are present
309+ // in mapModifiedTx (which implies that the mapTx ancestor state is
310+ // stale due to ancestor inclusion in the block)
311+ // Also skip transactions that we've already failed to add. This can happen if
312+ // we consider a transaction in mapModifiedTx and it fails: we can then
313+ // potentially consider it again while walking mapTx. It's currently
314+ // guaranteed to fail again, but as a belt-and-suspenders check we put it in
315+ // failedTx and avoid re-evaluation, since the re-evaluation would be using
316+ // cached size/sigops/fee values that are not actually correct.
317+ /* * Return true if given transaction from mapTx has already been evaluated,
318+ * or if the transaction's cached data in mapTx is incorrect. */
319+ if (mi != m_mempool.mapTx .get <ancestor_score>().end ()) {
320+ auto it = m_mempool.mapTx .project <0 >(mi);
321+ assert (it != m_mempool.mapTx .end ());
322+ if (mapModifiedTx.count (it) || inBlock.count (it) || failedTx.count (it)) {
323+ ++mi;
324+ continue ;
325+ }
328326 }
329327
330328 // Now that mi is not stale, determine which transaction to evaluate:
0 commit comments