@@ -432,8 +432,7 @@ class MemPoolAccept
432
432
m_pool(mempool),
433
433
m_view(&m_dummy),
434
434
m_viewmempool(&active_chainstate.CoinsTip(), m_pool),
435
- m_active_chainstate(active_chainstate),
436
- m_limits{m_pool.m_limits }
435
+ m_active_chainstate(active_chainstate)
437
436
{
438
437
}
439
438
@@ -683,8 +682,6 @@ class MemPoolAccept
683
682
684
683
Chainstate& m_active_chainstate;
685
684
686
- CTxMemPool::Limits m_limits;
687
-
688
685
/* * Whether the transaction(s) would replace any mempool transactions. If so, RBF rules apply. */
689
686
bool m_rbf{false };
690
687
};
@@ -873,6 +870,11 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
873
870
if (!bypass_limits && !args.m_package_feerates && !CheckFeeRate (ws.m_vsize , ws.m_modified_fees , state)) return false ;
874
871
875
872
ws.m_iters_conflicting = m_pool.GetIterSet (ws.m_conflicts );
873
+
874
+ // Note that these modifications are only applicable to single transaction scenarios;
875
+ // carve-outs and package RBF are disabled for multi-transaction evaluations.
876
+ CTxMemPool::Limits maybe_rbf_limits = m_pool.m_limits ;
877
+
876
878
// Calculate in-mempool ancestors, up to a limit.
877
879
if (ws.m_conflicts .size () == 1 ) {
878
880
// In general, when we receive an RBF transaction with mempool conflicts, we want to know whether we
@@ -905,11 +907,11 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
905
907
assert (ws.m_iters_conflicting .size () == 1 );
906
908
CTxMemPool::txiter conflict = *ws.m_iters_conflicting .begin ();
907
909
908
- m_limits .descendant_count += 1 ;
909
- m_limits .descendant_size_vbytes += conflict->GetSizeWithDescendants ();
910
+ maybe_rbf_limits .descendant_count += 1 ;
911
+ maybe_rbf_limits .descendant_size_vbytes += conflict->GetSizeWithDescendants ();
910
912
}
911
913
912
- auto ancestors{m_pool.CalculateMemPoolAncestors (*entry, m_limits )};
914
+ auto ancestors{m_pool.CalculateMemPoolAncestors (*entry, maybe_rbf_limits )};
913
915
if (!ancestors) {
914
916
// If CalculateMemPoolAncestors fails second time, we want the original error string.
915
917
// Contracting/payment channels CPFP carve-out:
@@ -925,9 +927,9 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
925
927
// this, see https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2018-November/016518.html
926
928
CTxMemPool::Limits cpfp_carve_out_limits{
927
929
.ancestor_count = 2 ,
928
- .ancestor_size_vbytes = m_limits .ancestor_size_vbytes ,
929
- .descendant_count = m_limits .descendant_count + 1 ,
930
- .descendant_size_vbytes = m_limits .descendant_size_vbytes + EXTRA_DESCENDANT_TX_SIZE_LIMIT,
930
+ .ancestor_size_vbytes = maybe_rbf_limits .ancestor_size_vbytes ,
931
+ .descendant_count = maybe_rbf_limits .descendant_count + 1 ,
932
+ .descendant_size_vbytes = maybe_rbf_limits .descendant_size_vbytes + EXTRA_DESCENDANT_TX_SIZE_LIMIT,
931
933
};
932
934
const auto error_message{util::ErrorString (ancestors).original };
933
935
if (ws.m_vsize > EXTRA_DESCENDANT_TX_SIZE_LIMIT) {
@@ -1010,7 +1012,7 @@ bool MemPoolAccept::PackageMempoolChecks(const std::vector<CTransactionRef>& txn
1010
1012
{ return !m_pool.exists (GenTxid::Txid (tx->GetHash ()));}));
1011
1013
1012
1014
std::string err_string;
1013
- if (!m_pool.CheckPackageLimits (txns, m_limits, err_string)) {
1015
+ if (!m_pool.CheckPackageLimits (txns, err_string)) {
1014
1016
// This is a package-wide error, separate from an individual transaction error.
1015
1017
return package_state.Invalid (PackageValidationResult::PCKG_POLICY, " package-mempool-limits" , err_string);
1016
1018
}
@@ -1165,7 +1167,7 @@ bool MemPoolAccept::SubmitPackage(const ATMPArgs& args, std::vector<Workspace>&
1165
1167
// Re-calculate mempool ancestors to call addUnchecked(). They may have changed since the
1166
1168
// last calculation done in PreChecks, since package ancestors have already been submitted.
1167
1169
{
1168
- auto ancestors{m_pool.CalculateMemPoolAncestors (*ws.m_entry , m_limits)};
1170
+ auto ancestors{m_pool.CalculateMemPoolAncestors (*ws.m_entry , m_pool. m_limits )};
1169
1171
if (!ancestors) {
1170
1172
results.emplace (ws.m_ptx ->GetWitnessHash (), MempoolAcceptResult::Failure (ws.m_state ));
1171
1173
// Since PreChecks() and PackageMempoolChecks() both enforce limits, this should never fail.
0 commit comments