From 1412b779ad0a7d98396e45676ba75bd8e90446e0 Mon Sep 17 00:00:00 2001 From: ismaelsadeeq Date: Fri, 9 Jan 2026 18:35:08 +0000 Subject: [PATCH] refactor: execute `PackageMempoolChecks` during package rbf only - No need to jump into the next subroutine when there is no conflict. - This makes it clear why it is necessary to have two calls of CheckMempoolPolicyLimts in both PackageMempoolChecks and after in AcceptMultipleTransactionsInternal, there is a possibilty that we we want to accept multiple transaction but they are not conflicting with any in-mempool transaction, in that case also we want to check that they do not bust the cluster limits. --- src/validation.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index b6da6d2d8d6..a56bc0548ff 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1048,9 +1048,6 @@ bool MemPoolAccept::PackageMempoolChecks(const std::vector& txn assert(txns.size() == workspaces.size()); - // No conflicts means we're finished. Further checks are all RBF-only. - if (!m_subpackage.m_rbf) return true; - // We're in package RBF context; replacement proposal must be size 2 if (workspaces.size() != 2 || !Assume(IsChildWithParents(txns))) { return package_state.Invalid(PackageValidationResult::PCKG_POLICY, "package RBF failed: package must be 1-parent-1-child"); @@ -1516,7 +1513,7 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptMultipleTransactionsInternal(con } // Apply package mempool RBF checks. - if (!PackageMempoolChecks(txns, workspaces, m_subpackage.m_total_vsize, package_state)) { + if (m_subpackage.m_rbf && !PackageMempoolChecks(txns, workspaces, m_subpackage.m_total_vsize, package_state)) { return PackageMempoolAcceptResult(package_state, std::move(results)); }