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.
This commit is contained in:
ismaelsadeeq
2026-01-09 18:35:08 +00:00
parent 595504a432
commit 1412b779ad

View File

@@ -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));
}