@@ -635,7 +635,7 @@ class MemPoolAccept
635
635
CTxMemPool::setEntries m_ancestors;
636
636
/* Handle to the tx in the changeset */
637
637
CTxMemPool::ChangeSet::TxHandle m_tx_handle;
638
- /* * Whether RBF-related data structures (m_conflicts, m_iters_conflicting, m_all_conflicting,
638
+ /* * Whether RBF-related data structures (m_conflicts, m_iters_conflicting,
639
639
* m_replaced_transactions) include a sibling in addition to txns with conflicting inputs. */
640
640
bool m_sibling_eviction{false };
641
641
@@ -739,8 +739,6 @@ class MemPoolAccept
739
739
/* * Whether the transaction(s) would replace any mempool transactions and/or evict any siblings.
740
740
* If so, RBF rules apply. */
741
741
bool m_rbf{false };
742
- /* * All directly conflicting mempool transactions and their descendants. */
743
- CTxMemPool::setEntries m_all_conflicts;
744
742
/* * Mempool transactions that were replaced. */
745
743
std::list<CTransactionRef> m_replaced_transactions;
746
744
/* Changeset representing adding transactions and removing their conflicts. */
@@ -1089,13 +1087,15 @@ bool MemPoolAccept::ReplacementChecks(Workspace& ws)
1089
1087
strprintf (" insufficient fee%s" , ws.m_sibling_eviction ? " (including sibling eviction)" : " " ), *err_string);
1090
1088
}
1091
1089
1090
+ CTxMemPool::setEntries all_conflicts;
1091
+
1092
1092
// Calculate all conflicting entries and enforce Rule #5.
1093
- if (const auto err_string{GetEntriesForConflicts (tx, m_pool, ws.m_iters_conflicting , m_subpackage. m_all_conflicts )}) {
1093
+ if (const auto err_string{GetEntriesForConflicts (tx, m_pool, ws.m_iters_conflicting , all_conflicts )}) {
1094
1094
return state.Invalid (TxValidationResult::TX_MEMPOOL_POLICY,
1095
1095
strprintf (" too many potential replacements%s" , ws.m_sibling_eviction ? " (including sibling eviction)" : " " ), *err_string);
1096
1096
}
1097
1097
// Enforce Rule #2.
1098
- if (const auto err_string{HasNoNewUnconfirmed (tx, m_pool, m_subpackage. m_all_conflicts )}) {
1098
+ if (const auto err_string{HasNoNewUnconfirmed (tx, m_pool, all_conflicts )}) {
1099
1099
// Sibling eviction is only done for TRUC transactions, which cannot have multiple ancestors.
1100
1100
Assume (!ws.m_sibling_eviction );
1101
1101
return state.Invalid (TxValidationResult::TX_MEMPOOL_POLICY,
@@ -1104,7 +1104,7 @@ bool MemPoolAccept::ReplacementChecks(Workspace& ws)
1104
1104
1105
1105
// Check if it's economically rational to mine this transaction rather than the ones it
1106
1106
// replaces and pays for its own relay fees. Enforce Rules #3 and #4.
1107
- for (CTxMemPool::txiter it : m_subpackage. m_all_conflicts ) {
1107
+ for (CTxMemPool::txiter it : all_conflicts ) {
1108
1108
m_subpackage.m_conflicting_fees += it->GetModifiedFee ();
1109
1109
m_subpackage.m_conflicting_size += it->GetTxSize ();
1110
1110
}
@@ -1116,7 +1116,7 @@ bool MemPoolAccept::ReplacementChecks(Workspace& ws)
1116
1116
}
1117
1117
1118
1118
// Add all the to-be-removed transactions to the changeset.
1119
- for (auto it : m_subpackage. m_all_conflicts ) {
1119
+ for (auto it : all_conflicts ) {
1120
1120
m_subpackage.m_changeset ->StageRemoval (it);
1121
1121
}
1122
1122
return true ;
@@ -1172,14 +1172,15 @@ bool MemPoolAccept::PackageMempoolChecks(const std::vector<CTransactionRef>& txn
1172
1172
1173
1173
// Don't consider replacements that would cause us to remove a large number of mempool entries.
1174
1174
// This limit is not increased in a package RBF. Use the aggregate number of transactions.
1175
+ CTxMemPool::setEntries all_conflicts;
1175
1176
if (const auto err_string{GetEntriesForConflicts (*child_ws.m_ptx , m_pool, direct_conflict_iters,
1176
- m_subpackage. m_all_conflicts )}) {
1177
+ all_conflicts )}) {
1177
1178
return package_state.Invalid (PackageValidationResult::PCKG_POLICY,
1178
1179
" package RBF failed: too many potential replacements" , *err_string);
1179
1180
}
1180
1181
1181
1182
1182
- for (CTxMemPool::txiter it : m_subpackage. m_all_conflicts ) {
1183
+ for (CTxMemPool::txiter it : all_conflicts ) {
1183
1184
m_subpackage.m_changeset ->StageRemoval (it);
1184
1185
m_subpackage.m_conflicting_fees += it->GetModifiedFee ();
1185
1186
m_subpackage.m_conflicting_size += it->GetTxSize ();
@@ -1287,9 +1288,9 @@ void MemPoolAccept::FinalizeSubpackage(const ATMPArgs& args)
1287
1288
AssertLockHeld (cs_main);
1288
1289
AssertLockHeld (m_pool.cs );
1289
1290
1290
- if (!m_subpackage.m_all_conflicts .empty ()) Assume (args.m_allow_replacement );
1291
+ if (!m_subpackage.m_changeset -> GetRemovals () .empty ()) Assume (args.m_allow_replacement );
1291
1292
// Remove conflicting transactions from the mempool
1292
- for (CTxMemPool::txiter it : m_subpackage.m_all_conflicts )
1293
+ for (CTxMemPool::txiter it : m_subpackage.m_changeset -> GetRemovals () )
1293
1294
{
1294
1295
std::string log_string = strprintf (" replacing mempool tx %s (wtxid=%s, fees=%s, vsize=%s). " ,
1295
1296
it->GetTx ().GetHash ().ToString (),
@@ -1329,9 +1330,6 @@ void MemPoolAccept::FinalizeSubpackage(const ATMPArgs& args)
1329
1330
}
1330
1331
m_subpackage.m_changeset ->Apply ();
1331
1332
m_subpackage.m_changeset .reset ();
1332
- // Don't attempt to process the same conflicts repeatedly during subpackage evaluation:
1333
- // they no longer exist on subsequent calls to Finalize() post-Apply()
1334
- m_subpackage.m_all_conflicts .clear ();
1335
1333
}
1336
1334
1337
1335
bool MemPoolAccept::SubmitPackage (const ATMPArgs& args, std::vector<Workspace>& workspaces,
0 commit comments