Page MenuHomePhabricator

D12174.id35513.diff
No OneTemporary

D12174.id35513.diff

diff --git a/src/bench/mempool_stress.cpp b/src/bench/mempool_stress.cpp
--- a/src/bench/mempool_stress.cpp
+++ b/src/bench/mempool_stress.cpp
@@ -116,12 +116,14 @@
TestingSetup(CBaseChainParams::MAIN, {"-checkmempool=1"});
CTxMemPool pool;
LOCK2(cs_main, pool.cs);
+ const CCoinsViewCache &coins_tip =
+ testing_setup.m_node.chainman->ActiveChainstate().CoinsTip();
for (auto &tx : ordered_coins) {
AddTx(tx, pool);
}
bench.run([&]() NO_THREAD_SAFETY_ANALYSIS {
- pool.check(testing_setup.m_node.chainman->ActiveChainstate());
+ pool.check(coins_tip, /* spendheight */ 2);
});
}
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -3121,7 +3121,9 @@
break;
}
}
- m_mempool.check(m_chainman.ActiveChainstate());
+ CChainState &active_chainstate = m_chainman.ActiveChainstate();
+ m_mempool.check(active_chainstate.CoinsTip(),
+ active_chainstate.m_chain.Height() + 1);
}
bool PeerManagerImpl::PrepareBlockFilterRequest(
@@ -4341,7 +4343,9 @@
ptx, false /* bypass_limits */);
const TxValidationState &state = result.m_state;
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
- m_mempool.check(m_chainman.ActiveChainstate());
+ CChainState &active_chainstate = m_chainman.ActiveChainstate();
+ m_mempool.check(active_chainstate.CoinsTip(),
+ active_chainstate.m_chain.Height() + 1);
// As this version of the transaction was acceptable, we can forget
// about any requests for it.
m_txrequest.ForgetInvId(tx.GetId());
diff --git a/src/txmempool.h b/src/txmempool.h
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -635,8 +635,8 @@
* are in the mapNextTx array). If sanity-checking is turned off, check does
* nothing.
*/
- void check(CChainState &active_chainstate) const
- EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
+ void check(const CCoinsViewCache &active_coins_tip,
+ int64_t spendheight) const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
// addUnchecked must updated state for all ancestors of a given transaction,
// to track size/count of descendant transactions. First version of
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -716,7 +716,8 @@
_clear();
}
-void CTxMemPool::check(CChainState &active_chainstate) const {
+void CTxMemPool::check(const CCoinsViewCache &active_coins_tip,
+ int64_t spendheight) const {
if (m_check_ratio == 0) {
return;
}
@@ -736,10 +737,8 @@
uint64_t innerUsage = 0;
uint64_t prev_ancestor_count{0};
- CCoinsViewCache &active_coins_tip = active_chainstate.CoinsTip();
CCoinsViewCache mempoolDuplicate(
const_cast<CCoinsViewCache *>(&active_coins_tip));
- const int64_t spendheight = active_chainstate.m_chain.Height() + 1;
for (const auto &it : GetSortedDepthAndScore()) {
checkTotal += it->GetTxSize();
diff --git a/src/validation.cpp b/src/validation.cpp
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -2831,7 +2831,7 @@
disconnectpool.updateMempoolForReorg(config, *this, true, m_mempool);
}
- m_mempool.check(*this);
+ m_mempool.check(this->CoinsTip(), this->m_chain.Height() + 1);
// Callbacks/notifications for a new best chain.
if (fInvalidFound) {

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 26, 12:06 (2 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573509
Default Alt Text
D12174.id35513.diff (3 KB)

Event Timeline