From cdb893443cc16edf974f099b8485e04b3db1b1d7 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 11 Nov 2019 10:43:34 -0500 Subject: [validation interface] Remove vtxConflicted from BlockConnected The wallet now uses TransactionRemovedFromMempool to be notified about conflicted wallet, and no other clients use vtxConflicted. --- src/validation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/validation.cpp') diff --git a/src/validation.cpp b/src/validation.cpp index bab04b8e34..3f6f358092 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2881,7 +2881,7 @@ bool CChainState::ActivateBestChain(BlockValidationState &state, const CChainPar for (const PerBlockConnectTrace& trace : connectTrace.GetBlocksConnected()) { assert(trace.pblock && trace.pindex); - GetMainSignals().BlockConnected(trace.pblock, trace.pindex, trace.conflictedTxs); + GetMainSignals().BlockConnected(trace.pblock, trace.pindex); } } while (!m_chain.Tip() || (starting_tip && CBlockIndexWorkComparator()(m_chain.Tip(), starting_tip))); if (!blocks_connected) return true; -- cgit v1.2.3 From 5613f9842b4000fed088b8cf7b99674c328d15e1 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 11 Nov 2019 10:46:09 -0500 Subject: [validation] Remove conflictedTxs from PerBlockConnectTrace Since we don't add a vtxConflicted vector to BlockConnected the conflictedTxs member of PerBlockConnectTrace is no longer used. --- src/validation.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'src/validation.cpp') diff --git a/src/validation.cpp b/src/validation.cpp index 3f6f358092..c5318293bc 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2505,22 +2505,12 @@ static int64_t nTimePostConnect = 0; struct PerBlockConnectTrace { CBlockIndex* pindex = nullptr; std::shared_ptr pblock; - std::shared_ptr> conflictedTxs; - PerBlockConnectTrace() : conflictedTxs(std::make_shared>()) {} + PerBlockConnectTrace() {} }; /** * Used to track blocks whose transactions were applied to the UTXO state as a * part of a single ActivateBestChainStep call. * - * This class also tracks transactions that are removed from the mempool as - * conflicts (per block) and can be used to pass all those transactions - * through SyncTransaction. - * - * This class assumes (and asserts) that the conflicted transactions for a given - * block are added via mempool callbacks prior to the BlockConnected() associated - * with those transactions. If any transactions are marked conflicted, it is - * assumed that an associated block will always be added. - * * This class is single-use, once you call GetBlocksConnected() you have to throw * it away and make a new one. */ @@ -2551,16 +2541,12 @@ public: // one waiting for the transactions from the next block. We pop // the last entry here to make sure the list we return is sane. assert(!blocksConnected.back().pindex); - assert(blocksConnected.back().conflictedTxs->empty()); blocksConnected.pop_back(); return blocksConnected; } void NotifyEntryRemoved(CTransactionRef txRemoved, MemPoolRemovalReason reason) { assert(!blocksConnected.back().pindex); - if (reason == MemPoolRemovalReason::CONFLICT) { - blocksConnected.back().conflictedTxs->emplace_back(std::move(txRemoved)); - } } }; -- cgit v1.2.3 From 969b65f3f527631ede1a31c7855151e5c5d91f8f Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 11 Nov 2019 10:50:21 -0500 Subject: [validation] Remove NotifyEntryRemoved callback from ConnectTrace ConnectTrace used to subscribe to the mempool's NotifyEntryRemoved callback to be notified of transactions removed for conflict. Since PerBlockConnectTrace no longer tracks conflicted transactions, ConnectTrace no longer requires these notifications. --- src/validation.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/validation.cpp') diff --git a/src/validation.cpp b/src/validation.cpp index c5318293bc..1f1585041a 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2518,12 +2518,9 @@ class ConnectTrace { private: std::vector blocksConnected; CTxMemPool &pool; - boost::signals2::scoped_connection m_connNotifyEntryRemoved; public: - explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) { - m_connNotifyEntryRemoved = pool.NotifyEntryRemoved.connect(std::bind(&ConnectTrace::NotifyEntryRemoved, this, std::placeholders::_1, std::placeholders::_2)); - } + explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) {} void BlockConnected(CBlockIndex* pindex, std::shared_ptr pblock) { assert(!blocksConnected.back().pindex); @@ -2544,10 +2541,6 @@ public: blocksConnected.pop_back(); return blocksConnected; } - - void NotifyEntryRemoved(CTransactionRef txRemoved, MemPoolRemovalReason reason) { - assert(!blocksConnected.back().pindex); - } }; /** -- cgit v1.2.3 From 2dd561f36124972d2364f941de9c3417c65f05b6 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Fri, 15 Nov 2019 15:33:27 -0500 Subject: [validation] Remove pool member from ConnectTrace It's no longer used for anything. --- src/validation.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/validation.cpp') diff --git a/src/validation.cpp b/src/validation.cpp index 1f1585041a..6d6ba80564 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2517,10 +2517,9 @@ struct PerBlockConnectTrace { class ConnectTrace { private: std::vector blocksConnected; - CTxMemPool &pool; public: - explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) {} + explicit ConnectTrace() : blocksConnected(1) {} void BlockConnected(CBlockIndex* pindex, std::shared_ptr pblock) { assert(!blocksConnected.back().pindex); @@ -2833,7 +2832,7 @@ bool CChainState::ActivateBestChain(BlockValidationState &state, const CChainPar do { // We absolutely may not unlock cs_main until we've made forward progress // (with the exception of shutdown due to hardware issues, low disk space, etc). - ConnectTrace connectTrace(mempool); // Destructed before cs_main is unlocked + ConnectTrace connectTrace; // Destructed before cs_main is unlocked if (pindexMostWork == nullptr) { pindexMostWork = FindMostWorkChain(); -- cgit v1.2.3