Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13711361
D12174.id35527.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D12174.id35527.diff
View Options
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
@@ -638,8 +638,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
@@ -748,7 +748,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;
}
@@ -768,10 +769,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
@@ -2847,7 +2847,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
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 26, 11:46 (4 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573439
Default Alt Text
D12174.id35527.diff (3 KB)
Attached To
D12174: [refactor] pass coinsview and height to check()
Event Timeline
Log In to Comment