@@ -688,9 +688,7 @@ class MemPoolAccept
688
688
bool ConsensusScriptChecks (const ATMPArgs& args, Workspace& ws) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_pool.cs);
689
689
690
690
// Try to add the transaction to the mempool, removing any conflicts first.
691
- // Returns true if the transaction is in the mempool after any size
692
- // limiting is performed, false otherwise.
693
- bool FinalizeSubpackage (const ATMPArgs& args, std::vector<Workspace>& ws) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_pool.cs);
691
+ void FinalizeSubpackage (const ATMPArgs& args, std::vector<Workspace>& ws) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_pool.cs);
694
692
695
693
// Submit all transactions to the mempool and call ConsensusScriptChecks to add to the script
696
694
// cache - should only be called after successful validation of all transactions in the package.
@@ -1285,14 +1283,12 @@ bool MemPoolAccept::ConsensusScriptChecks(const ATMPArgs& args, Workspace& ws)
1285
1283
return true ;
1286
1284
}
1287
1285
1288
- bool MemPoolAccept::FinalizeSubpackage (const ATMPArgs& args, std::vector<Workspace>& workspaces)
1286
+ void MemPoolAccept::FinalizeSubpackage (const ATMPArgs& args, std::vector<Workspace>& workspaces)
1289
1287
{
1290
1288
AssertLockHeld (cs_main);
1291
1289
AssertLockHeld (m_pool.cs );
1292
1290
const CTransaction& tx = *workspaces.front ().m_ptx ;
1293
1291
const uint256& hash = workspaces.front ().m_hash ;
1294
- TxValidationState& state = workspaces.front ().m_state ;
1295
- const bool bypass_limits = args.m_bypass_limits ;
1296
1292
1297
1293
if (!m_subpackage.m_all_conflicts .empty ()) Assume (args.m_allow_replacement );
1298
1294
// Remove conflicting transactions from the mempool
@@ -1323,18 +1319,6 @@ bool MemPoolAccept::FinalizeSubpackage(const ATMPArgs& args, std::vector<Workspa
1323
1319
// Don't attempt to process the same conflicts repeatedly during subpackage evaluation:
1324
1320
// they no longer exist on subsequent calls to Finalize() post-Apply()
1325
1321
m_subpackage.m_all_conflicts .clear ();
1326
-
1327
- // trim mempool and check if tx was trimmed
1328
- // If we are validating a package, don't trim here because we could evict a previous transaction
1329
- // in the package. LimitMempoolSize() should be called at the very end to make sure the mempool
1330
- // is still within limits and package submission happens atomically.
1331
- if (!args.m_package_submission && !bypass_limits) {
1332
- LimitMempoolSize (m_pool, m_active_chainstate.CoinsTip ());
1333
- if (!m_pool.exists (GenTxid::Txid (hash)))
1334
- // The tx no longer meets our (new) mempool minimum feerate but could be reconsidered in a package.
1335
- return state.Invalid (TxValidationResult::TX_RECONSIDERABLE, " mempool full" );
1336
- }
1337
- return true ;
1338
1322
}
1339
1323
1340
1324
bool MemPoolAccept::SubmitPackage (const ATMPArgs& args, std::vector<Workspace>& workspaces,
@@ -1467,11 +1451,19 @@ MempoolAcceptResult MemPoolAccept::AcceptSingleTransaction(const CTransactionRef
1467
1451
ws.m_base_fees , effective_feerate, single_wtxid);
1468
1452
}
1469
1453
1470
- if (!FinalizeSubpackage (args, workspaces)) {
1471
- // The only possible failure reason is fee-related (mempool full).
1472
- // Failed for fee reasons. Provide the effective feerate and which txns were included.
1473
- Assume (ws.m_state .GetResult () == TxValidationResult::TX_RECONSIDERABLE);
1474
- return MempoolAcceptResult::FeeFailure (ws.m_state , CFeeRate (ws.m_modified_fees , ws.m_vsize ), {ws.m_ptx ->GetWitnessHash ()});
1454
+ FinalizeSubpackage (args, workspaces);
1455
+
1456
+ // trim mempool and check if tx was trimmed
1457
+ // If we are validating a package, don't trim here because we could evict a previous transaction
1458
+ // in the package. LimitMempoolSize() should be called at the very end to make sure the mempool
1459
+ // is still within limits and package submission happens atomically.
1460
+ if (!args.m_package_submission && !args.m_bypass_limits ) {
1461
+ LimitMempoolSize (m_pool, m_active_chainstate.CoinsTip ());
1462
+ if (!m_pool.exists (GenTxid::Txid (ws.m_hash ))) {
1463
+ // The tx no longer meets our (new) mempool minimum feerate but could be reconsidered in a package.
1464
+ ws.m_state .Invalid (TxValidationResult::TX_RECONSIDERABLE, " mempool full" );
1465
+ return MempoolAcceptResult::FeeFailure (ws.m_state , CFeeRate (ws.m_modified_fees , ws.m_vsize ), {ws.m_ptx ->GetWitnessHash ()});
1466
+ }
1475
1467
}
1476
1468
1477
1469
if (m_pool.m_opts .signals ) {
0 commit comments