From ac9aa71b7f9d6d0c694087dc7fa842c5cf573b1c Mon Sep 17 00:00:00 2001 From: Greg Sanders Date: Mon, 6 Apr 2026 16:43:46 -0400 Subject: [PATCH] mempool: remove all subsequent tx in pkg on failure This belt-and-suspenders check, if ever hit in production, could result in an inconsistent mempool if somehow the parent failed in the ConsensusScriptChecks but the child did not. Rather than allow the mempool to get in an inconsistent state, remove the following txs in the package. --- src/validation.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/validation.cpp b/src/validation.cpp index fc15c26d6f0..4cf3878006d 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1264,7 +1264,9 @@ bool MemPoolAccept::SubmitPackage(const ATMPArgs& args, std::vector& package_state.Invalid(PackageValidationResult::PCKG_MEMPOOL_ERROR, strprintf("BUG! PolicyScriptChecks succeeded but ConsensusScriptChecks failed: %s", ws.m_ptx->GetHash().ToString())); - // Remove the transaction from the mempool. + } + // Remove first failing tx and all subsequent in package + if (!all_submitted) { if (!m_subpackage.m_changeset) m_subpackage.m_changeset = m_pool.GetChangeSet(); m_subpackage.m_changeset->StageRemoval(m_pool.GetIter(ws.m_ptx->GetHash()).value()); }