@@ -457,10 +457,12 @@ class MemPoolAccept
457457 std::vector<COutPoint>& m_coins_to_uncache;
458458 /* * When true, the transaction or package will not be submitted to the mempool. */
459459 const bool m_test_accept;
460- /* * Whether we allow transactions to replace mempool transactions by BIP125 rules . If false,
460+ /* * Whether we allow transactions to replace mempool transactions. If false,
461461 * any transaction spending the same inputs as a transaction in the mempool is considered
462462 * a conflict. */
463463 const bool m_allow_replacement;
464+ /* * When true, allow sibling eviction. This only occurs in single transaction package settings. */
465+ const bool m_allow_sibling_eviction;
464466 /* * When true, the mempool will not be trimmed when any transactions are submitted in
465467 * Finalize(). Instead, limits should be enforced at the end to ensure the package is not
466468 * partially submitted.
@@ -486,6 +488,7 @@ class MemPoolAccept
486488 /* m_coins_to_uncache */ coins_to_uncache,
487489 /* m_test_accept */ test_accept,
488490 /* m_allow_replacement */ true ,
491+ /* m_allow_sibling_eviction */ true ,
489492 /* m_package_submission */ false ,
490493 /* m_package_feerates */ false ,
491494 /* m_client_maxfeerate */ {}, // checked by caller
@@ -501,6 +504,7 @@ class MemPoolAccept
501504 /* m_coins_to_uncache */ coins_to_uncache,
502505 /* m_test_accept */ true ,
503506 /* m_allow_replacement */ false ,
507+ /* m_allow_sibling_eviction */ false ,
504508 /* m_package_submission */ false , // not submitting to mempool
505509 /* m_package_feerates */ false ,
506510 /* m_client_maxfeerate */ {}, // checked by caller
@@ -516,6 +520,7 @@ class MemPoolAccept
516520 /* m_coins_to_uncache */ coins_to_uncache,
517521 /* m_test_accept */ false ,
518522 /* m_allow_replacement */ false ,
523+ /* m_allow_sibling_eviction */ false ,
519524 /* m_package_submission */ true ,
520525 /* m_package_feerates */ true ,
521526 /* m_client_maxfeerate */ client_maxfeerate,
@@ -530,6 +535,7 @@ class MemPoolAccept
530535 /* m_coins_to_uncache */ package_args.m_coins_to_uncache ,
531536 /* m_test_accept */ package_args.m_test_accept ,
532537 /* m_allow_replacement */ true ,
538+ /* m_allow_sibling_eviction */ true ,
533539 /* m_package_submission */ true , // do not LimitMempoolSize in Finalize()
534540 /* m_package_feerates */ false , // only 1 transaction
535541 /* m_client_maxfeerate */ package_args.m_client_maxfeerate ,
@@ -545,6 +551,7 @@ class MemPoolAccept
545551 std::vector<COutPoint>& coins_to_uncache,
546552 bool test_accept,
547553 bool allow_replacement,
554+ bool allow_sibling_eviction,
548555 bool package_submission,
549556 bool package_feerates,
550557 std::optional<CFeeRate> client_maxfeerate)
@@ -554,6 +561,7 @@ class MemPoolAccept
554561 m_coins_to_uncache{coins_to_uncache},
555562 m_test_accept{test_accept},
556563 m_allow_replacement{allow_replacement},
564+ m_allow_sibling_eviction{allow_sibling_eviction},
557565 m_package_submission{package_submission},
558566 m_package_feerates{package_feerates},
559567 m_client_maxfeerate{client_maxfeerate}
@@ -981,8 +989,11 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
981989 // check using the full ancestor set here because it's more convenient to use what we have
982990 // already calculated.
983991 if (const auto err{SingleV3Checks (ws.m_ptx , ws.m_ancestors , ws.m_conflicts , ws.m_vsize )}) {
984- // Disabled within package validation.
985- if (err->second != nullptr && args.m_allow_replacement ) {
992+ // Single transaction contexts only.
993+ if (args.m_allow_sibling_eviction && err->second != nullptr ) {
994+ // We should only be considering where replacement is considered valid as well.
995+ Assume (args.m_allow_replacement );
996+
986997 // Potential sibling eviction. Add the sibling to our list of mempool conflicts to be
987998 // included in RBF checks.
988999 ws.m_conflicts .insert (err->second ->GetHash ());
0 commit comments