@@ -498,6 +498,7 @@ class MemPoolAccept
498
498
struct Workspace {
499
499
explicit Workspace (const CTransactionRef& ptx) : m_ptx(ptx), m_hash(ptx->GetHash ()) {}
500
500
std::set<uint256> m_conflicts;
501
+ CTxMemPool::setEntries m_iters_conflicting;
501
502
CTxMemPool::setEntries m_all_conflicting;
502
503
CTxMemPool::setEntries m_ancestors;
503
504
std::unique_ptr<CTxMemPoolEntry> m_entry;
@@ -745,7 +746,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
745
746
// blocks
746
747
if (!bypass_limits && !CheckFeeRate (ws.m_vsize , nModifiedFees, state)) return false ;
747
748
748
- const CTxMemPool::setEntries setIterConflicting = m_pool.GetIterSet (setConflicts);
749
+ ws. m_iters_conflicting = m_pool.GetIterSet (setConflicts);
749
750
// Calculate in-mempool ancestors, up to a limit.
750
751
if (setConflicts.size () == 1 ) {
751
752
// In general, when we receive an RBF transaction with mempool conflicts, we want to know whether we
@@ -775,8 +776,8 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
775
776
// the ancestor limits should be the same for both our new transaction and any conflicts).
776
777
// We don't bother incrementing m_limit_descendants by the full removal count as that limit never comes
777
778
// into force here (as we're only adding a single transaction).
778
- assert (setIterConflicting .size () == 1 );
779
- CTxMemPool::txiter conflict = *setIterConflicting .begin ();
779
+ assert (ws. m_iters_conflicting .size () == 1 );
780
+ CTxMemPool::txiter conflict = *ws. m_iters_conflicting .begin ();
780
781
781
782
m_limit_descendants += 1 ;
782
783
m_limit_descendant_size += conflict->GetSizeWithDescendants ();
@@ -823,17 +824,17 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
823
824
// more economically rational to mine. Before we go digging through the mempool for all
824
825
// transactions that would need to be removed (direct conflicts and all descendants), check
825
826
// that the replacement transaction pays more than its direct conflicts.
826
- if (const auto err_string{PaysMoreThanConflicts (setIterConflicting , newFeeRate, hash)}) {
827
+ if (const auto err_string{PaysMoreThanConflicts (ws. m_iters_conflicting , newFeeRate, hash)}) {
827
828
return state.Invalid (TxValidationResult::TX_MEMPOOL_POLICY, " insufficient fee" , *err_string);
828
829
}
829
830
830
831
// Calculate all conflicting entries and enforce BIP125 Rule #5.
831
- if (const auto err_string{GetEntriesForConflicts (tx, m_pool, setIterConflicting , allConflicting)}) {
832
+ if (const auto err_string{GetEntriesForConflicts (tx, m_pool, ws. m_iters_conflicting , allConflicting)}) {
832
833
return state.Invalid (TxValidationResult::TX_MEMPOOL_POLICY,
833
834
" too many potential replacements" , *err_string);
834
835
}
835
836
// Enforce BIP125 Rule #2.
836
- if (const auto err_string{HasNoNewUnconfirmed (tx, m_pool, setIterConflicting )}) {
837
+ if (const auto err_string{HasNoNewUnconfirmed (tx, m_pool, ws. m_iters_conflicting )}) {
837
838
return state.Invalid (TxValidationResult::TX_MEMPOOL_POLICY,
838
839
" replacement-adds-unconfirmed" , *err_string);
839
840
}
0 commit comments