refactor: execute `PackageMempoolChecks` during package rbf only
What changed, and why it matters
This is a small internal code cleanup in Bitcoin Core's transaction acceptance logic. It moves a check so that a package-replacement-specific validation routine is only called when actually processing a package RBF (replace-by-fee), rather than having that routine itself decide to return early when there is no conflict. The change does not alter the overall validation outcome and is described by the author as a refactor.
No security action required. Treat as normal code-review/refactor commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes an early return inside PackageMempoolChecks (if (!m_subpackage.m_rbf) return true;) and instead guards the call to PackageMempoolChecks with m_subpackage.m_rbf in AcceptMultipleTransactionsInternal. The function’s RBF-only checks (size-2, 1-parent-1-child, etc.) are now only executed in package RBF contexts. The commit message explicitly frames this as a refactor to clarify why CheckMempoolPolicyLimits is called in both PackageMempoolChecks and later in AcceptMultipleTransactionsInternal (non-conflicting multi-transaction submissions still need cluster-limit checks).
Changed components
src/validation.cppMemPoolAccept::PackageMempoolChecksMemPoolAccept::AcceptMultipleTransactionsInternalInspect captured patch +1 / −4
diff --git a/src/validation.cpp b/src/validation.cpp
index b6da6d2d..a56bc054 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1048,9 +1048,6 @@ bool MemPoolAccept::PackageMempoolChecks(const std::vector<CTransactionRef>& 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));
}
Why this scored 13/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.