Skip to content

Commit 76c72c6

Browse files
morcosfurszy
authored andcommitted
remove external usage of mempool conflict tracking
1 parent ef429af commit 76c72c6

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

src/test/mempool_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
415415
/* after tx6 is mined, tx7 should move up in the sort */
416416
std::vector<CTransactionRef> vtx;
417417
vtx.emplace_back(MakeTransactionRef(tx6));
418-
pool.removeForBlock(vtx, 1, nullptr, false);
418+
pool.removeForBlock(vtx, 1);
419419

420420
sortedOrder.erase(sortedOrder.begin()+1);
421421
// Ties are broken by hash

src/txmempool.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,11 @@ void CTxMemPool::AddTransactionsUpdated(unsigned int n)
368368
nTransactionsUpdated += n;
369369
}
370370

371-
372371
bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, setEntries &setAncestors, bool fCurrentEstimate)
373372
{
374373
// Add to memory pool without checking anything.
375374
// Used by AcceptToMemoryPool(), which DOES do all the appropriate checks.
376375
LOCK(cs);
377-
378376
indexed_transaction_set::iterator newit = mapTx.insert(entry).first;
379377
mapLinks.insert(make_pair(newit, TxLinks()));
380378

@@ -606,7 +604,7 @@ void CTxMemPool::removeConflicts(const CTransaction& tx, std::vector<CTransactio
606604
* Called when a block is connected. Removes from mempool and updates the miner fee estimator.
607605
*/
608606
void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight,
609-
std::vector<CTransactionRef>* conflicts, bool fCurrentEstimate)
607+
bool fCurrentEstimate)
610608
{
611609
LOCK(cs);
612610
std::vector<CTxMemPoolEntry> entries;
@@ -623,7 +621,7 @@ void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigne
623621
stage.insert(it);
624622
RemoveStaged(stage, true);
625623
}
626-
removeConflicts(*tx, conflicts);
624+
removeConflicts(*tx);
627625
ClearPrioritisation(tx->GetHash());
628626
}
629627
// After the txs in the new block have been removed from the mempool, update policy estimates

src/txmempool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ class CTxMemPool
527527
void removeWithAnchor(const uint256& invalidRoot);
528528
void removeConflicts(const CTransaction& tx, std::vector<CTransactionRef>* removed = nullptr);
529529
void removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight,
530-
std::vector<CTransactionRef>* conflicts = nullptr, bool fCurrentEstimate = true);
530+
bool fCurrentEstimate = true);
531531
void clear();
532532
void _clear(); // lock-free
533533
bool CompareDepthAndScore(const uint256& hasha, const uint256& hashb);

src/validation.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,11 +2023,10 @@ static int64_t nTimeChainState = 0;
20232023
static int64_t nTimePostConnect = 0;
20242024

20252025
/**
2026-
* Used to track conflicted transactions removed from mempool and transactions
2027-
* applied to the UTXO state as a part of a single ActivateBestChainStep call.
2026+
* Used to track blocks whose transactions were applied to the UTXO state as a
2027+
* part of a single ActivateBestChainStep call.
20282028
*/
20292029
struct ConnectTrace {
2030-
std::vector<CTransactionRef> txConflicted;
20312030
std::vector<std::pair<CBlockIndex*, std::shared_ptr<const CBlock> > > blocksConnected;
20322031
};
20332032

@@ -2092,7 +2091,7 @@ bool static ConnectTip(CValidationState& state, CBlockIndex* pindexNew, const st
20922091
LogPrint(BCLog::BENCH, " - Writing chainstate: %.2fms [%.2fs]\n", (nTime5 - nTime4) * 0.001, nTimeChainState * 0.000001);
20932092

20942093
// Remove conflicting transactions from the mempool.
2095-
mempool.removeForBlock(blockConnecting.vtx, pindexNew->nHeight, &connectTrace.txConflicted, !IsInitialBlockDownload());
2094+
mempool.removeForBlock(blockConnecting.vtx, pindexNew->nHeight, !IsInitialBlockDownload());
20962095
// Update chainActive & related variables.
20972096
UpdateTip(pindexNew);
20982097
// Update MN manager cache
@@ -2305,10 +2304,6 @@ bool ActivateBestChain(CValidationState& state, std::shared_ptr<const CBlock> pb
23052304
fInitialDownload = IsInitialBlockDownload();
23062305

23072306
// throw all transactions though the signal-interface
2308-
for (const auto &tx : connectTrace.txConflicted) {
2309-
GetMainSignals().SyncTransaction(*tx, pindexNewTip, CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK);
2310-
}
2311-
// ... and about transactions that got confirmed:
23122307
for (const auto& pair : connectTrace.blocksConnected) {
23132308
assert(pair.second);
23142309
const CBlock& block = *(pair.second);

0 commit comments

Comments
 (0)