Skip to content

Commit ac9aa71

Browse files
committed
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.
1 parent 74e7518 commit ac9aa71

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/validation.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,9 @@ bool MemPoolAccept::SubmitPackage(const ATMPArgs& args, std::vector<Workspace>&
12641264
package_state.Invalid(PackageValidationResult::PCKG_MEMPOOL_ERROR,
12651265
strprintf("BUG! PolicyScriptChecks succeeded but ConsensusScriptChecks failed: %s",
12661266
ws.m_ptx->GetHash().ToString()));
1267-
// Remove the transaction from the mempool.
1267+
}
1268+
// Remove first failing tx and all subsequent in package
1269+
if (!all_submitted) {
12681270
if (!m_subpackage.m_changeset) m_subpackage.m_changeset = m_pool.GetChangeSet();
12691271
m_subpackage.m_changeset->StageRemoval(m_pool.GetIter(ws.m_ptx->GetHash()).value());
12701272
}

0 commit comments

Comments
 (0)