Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864852
D13967.id40529.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Subscribers
None
D13967.id40529.diff
View Options
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -192,46 +192,6 @@
return true;
}
-bool CTxMemPool::CheckPackageLimits(const Package &package,
- uint64_t limitAncestorCount,
- uint64_t limitAncestorSize,
- uint64_t limitDescendantCount,
- uint64_t limitDescendantSize,
- std::string &errString) const {
- CTxMemPoolEntry::Parents staged_ancestors;
- size_t total_size = 0;
- for (const auto &tx : package) {
- total_size += GetVirtualTransactionSize(*tx);
- for (const auto &input : tx->vin) {
- std::optional<txiter> piter = GetIter(input.prevout.GetTxId());
- if (piter) {
- staged_ancestors.insert(**piter);
- if (staged_ancestors.size() + package.size() >
- limitAncestorCount) {
- errString =
- strprintf("too many unconfirmed parents [limit: %u]",
- limitAncestorCount);
- return false;
- }
- }
- }
- }
- // When multiple transactions are passed in, the ancestors and descendants
- // of all transactions considered together must be within limits even if
- // they are not interdependent. This may be stricter than the limits for
- // each individual transaction.
- setEntries setAncestors;
- const auto ret = CalculateAncestorsAndCheckLimits(
- total_size, package.size(), setAncestors, staged_ancestors,
- limitAncestorCount, limitAncestorSize, limitDescendantCount,
- limitDescendantSize, errString);
- // It's possible to overestimate the ancestor/descendant totals.
- if (!ret) {
- errString.insert(0, "possibly ");
- }
- return ret;
-}
-
bool CTxMemPool::CalculateMemPoolAncestors(
const CTxMemPoolEntry &entry, setEntries &setAncestors,
uint64_t limitAncestorCount, uint64_t limitAncestorSize,
diff --git a/src/validation.cpp b/src/validation.cpp
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -457,12 +457,6 @@
bool PreChecks(ATMPArgs &args, Workspace &ws)
EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_pool.cs);
- // Enforce package mempool ancestor/descendant limits (distinct from
- // individual ancestor/descendant limits done in PreChecks).
- bool PackageMempoolChecks(const std::vector<CTransactionRef> &txns,
- PackageValidationState &package_state)
- EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_pool.cs);
-
// Re-run the script checks, using consensus flags, and try to cache the
// result in the scriptcache. This should be done after
// PolicyScriptChecks(). This requires that all inputs either be in our
@@ -700,30 +694,6 @@
return true;
}
-bool MemPoolAccept::PackageMempoolChecks(
- const std::vector<CTransactionRef> &txns,
- PackageValidationState &package_state) {
- AssertLockHeld(cs_main);
- AssertLockHeld(m_pool.cs);
-
- // CheckPackageLimits expects the package transactions to not already be in
- // the mempool.
- assert(std::all_of(txns.cbegin(), txns.cend(), [this](const auto &tx) {
- return !m_pool.exists(tx->GetId());
- }));
-
- std::string err_string;
- if (!m_pool.CheckPackageLimits(txns, m_limit_ancestors,
- m_limit_ancestor_size, m_limit_descendants,
- m_limit_descendant_size, err_string)) {
- // This is a package-wide error, separate from an individual transaction
- // error.
- return package_state.Invalid(PackageValidationResult::PCKG_POLICY,
- "package-mempool-limits", err_string);
- }
- return true;
-}
-
bool MemPoolAccept::ConsensusScriptChecks(const ATMPArgs &args, Workspace &ws) {
AssertLockHeld(cs_main);
AssertLockHeld(m_pool.cs);
@@ -835,8 +805,6 @@
m_limit_descendant_size, unused_err_string)) {
results.emplace(ws.m_ptx->GetId(),
MempoolAcceptResult::Failure(ws.m_state));
- // Since PreChecks() and PackageMempoolChecks() both enforce limits,
- // this should never fail.
all_submitted = Assume(false);
}
// If we call LimitMempoolSize() for each individual Finalize(), the
@@ -996,15 +964,6 @@
}
}
- // Apply package mempool ancestor/descendant limits. Skip if there is only
- // one transaction, because it's unnecessary. Also, CPFP carve out can
- // increase the limit for individual transactions, but this exemption is
- // not extended to packages in CheckPackageLimits().
- std::string err_string;
- if (txns.size() > 1 && !PackageMempoolChecks(txns, package_state)) {
- return PackageMempoolAcceptResult(package_state, std::move(results));
- }
-
if (args.m_test_accept) {
return PackageMempoolAcceptResult(package_state, std::move(results));
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 22:52 (4 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5862144
Default Alt Text
D13967.id40529.diff (5 KB)
Attached To
D13967: Remove mempool tx package limits
Event Timeline
Log In to Comment