@@ -92,7 +92,7 @@ void CTxMemPool::UpdateForDescendants(txiter updateIt, cacheMap& cachedDescendan
92
92
// Don't directly remove the transaction here -- doing so would
93
93
// invalidate iterators in cachedDescendants. Mark it for removal
94
94
// by inserting into descendants_to_remove.
95
- if (descendant.GetCountWithAncestors () > uint64_t (m_limits. ancestor_count ) || descendant.GetSizeWithAncestors () > m_limits .ancestor_size_vbytes ) {
95
+ if (descendant.GetCountWithAncestors () > uint64_t (m_opts. limits . ancestor_count ) || descendant.GetSizeWithAncestors () > m_opts. limits .ancestor_size_vbytes ) {
96
96
descendants_to_remove.insert (descendant.GetTx ().GetHash ());
97
97
}
98
98
}
@@ -203,14 +203,14 @@ util::Result<void> CTxMemPool::CheckPackageLimits(const Package& package,
203
203
size_t pack_count = package.size ();
204
204
205
205
// Package itself is busting mempool limits; should be rejected even if no staged_ancestors exist
206
- if (pack_count > static_cast <uint64_t >(m_limits .ancestor_count )) {
207
- return util::Error{Untranslated (strprintf (" package count %u exceeds ancestor count limit [limit: %u]" , pack_count, m_limits .ancestor_count ))};
208
- } else if (pack_count > static_cast <uint64_t >(m_limits .descendant_count )) {
209
- return util::Error{Untranslated (strprintf (" package count %u exceeds descendant count limit [limit: %u]" , pack_count, m_limits .descendant_count ))};
210
- } else if (total_vsize > m_limits .ancestor_size_vbytes ) {
211
- return util::Error{Untranslated (strprintf (" package size %u exceeds ancestor size limit [limit: %u]" , total_vsize, m_limits .ancestor_size_vbytes ))};
212
- } else if (total_vsize > m_limits .descendant_size_vbytes ) {
213
- return util::Error{Untranslated (strprintf (" package size %u exceeds descendant size limit [limit: %u]" , total_vsize, m_limits .descendant_size_vbytes ))};
206
+ if (pack_count > static_cast <uint64_t >(m_opts. limits .ancestor_count )) {
207
+ return util::Error{Untranslated (strprintf (" package count %u exceeds ancestor count limit [limit: %u]" , pack_count, m_opts. limits .ancestor_count ))};
208
+ } else if (pack_count > static_cast <uint64_t >(m_opts. limits .descendant_count )) {
209
+ return util::Error{Untranslated (strprintf (" package count %u exceeds descendant count limit [limit: %u]" , pack_count, m_opts. limits .descendant_count ))};
210
+ } else if (total_vsize > m_opts. limits .ancestor_size_vbytes ) {
211
+ return util::Error{Untranslated (strprintf (" package size %u exceeds ancestor size limit [limit: %u]" , total_vsize, m_opts. limits .ancestor_size_vbytes ))};
212
+ } else if (total_vsize > m_opts. limits .descendant_size_vbytes ) {
213
+ return util::Error{Untranslated (strprintf (" package size %u exceeds descendant size limit [limit: %u]" , total_vsize, m_opts. limits .descendant_size_vbytes ))};
214
214
}
215
215
216
216
CTxMemPoolEntry::Parents staged_ancestors;
@@ -219,8 +219,8 @@ util::Result<void> CTxMemPool::CheckPackageLimits(const Package& package,
219
219
std::optional<txiter> piter = GetIter (input.prevout .hash );
220
220
if (piter) {
221
221
staged_ancestors.insert (**piter);
222
- if (staged_ancestors.size () + package.size () > static_cast <uint64_t >(m_limits .ancestor_count )) {
223
- return util::Error{Untranslated (strprintf (" too many unconfirmed parents [limit: %u]" , m_limits .ancestor_count ))};
222
+ if (staged_ancestors.size () + package.size () > static_cast <uint64_t >(m_opts. limits .ancestor_count )) {
223
+ return util::Error{Untranslated (strprintf (" too many unconfirmed parents [limit: %u]" , m_opts. limits .ancestor_count ))};
224
224
}
225
225
}
226
226
}
@@ -229,7 +229,7 @@ util::Result<void> CTxMemPool::CheckPackageLimits(const Package& package,
229
229
// considered together must be within limits even if they are not interdependent. This may be
230
230
// stricter than the limits for each individual transaction.
231
231
const auto ancestors{CalculateAncestorsAndCheckLimits (total_vsize, package.size (),
232
- staged_ancestors, m_limits )};
232
+ staged_ancestors, m_opts. limits )};
233
233
// It's possible to overestimate the ancestor/descendant totals.
234
234
if (!ancestors.has_value ()) return util::Error{Untranslated (" possibly " + util::ErrorString (ancestors).original )};
235
235
return {};
@@ -396,19 +396,7 @@ void CTxMemPoolEntry::UpdateAncestorState(int32_t modifySize, CAmount modifyFee,
396
396
}
397
397
398
398
CTxMemPool::CTxMemPool (const Options& opts)
399
- : m_check_ratio{opts.check_ratio },
400
- m_max_size_bytes{opts.max_size_bytes },
401
- m_expiry{opts.expiry },
402
- m_incremental_relay_feerate{opts.incremental_relay_feerate },
403
- m_min_relay_feerate{opts.min_relay_feerate },
404
- m_dust_relay_feerate{opts.dust_relay_feerate },
405
- m_permit_bare_multisig{opts.permit_bare_multisig },
406
- m_max_datacarrier_bytes{opts.max_datacarrier_bytes },
407
- m_require_standard{opts.require_standard },
408
- m_full_rbf{opts.full_rbf },
409
- m_persist_v1_dat{opts.persist_v1_dat },
410
- m_limits{opts.limits },
411
- m_signals{opts.signals }
399
+ : m_opts{opts}
412
400
{
413
401
}
414
402
@@ -489,12 +477,12 @@ void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason)
489
477
// even if not directly reported below.
490
478
uint64_t mempool_sequence = GetAndIncrementSequence ();
491
479
492
- if (reason != MemPoolRemovalReason::BLOCK && m_signals ) {
480
+ if (reason != MemPoolRemovalReason::BLOCK && m_opts. signals ) {
493
481
// Notify clients that a transaction has been removed from the mempool
494
482
// for any reason except being included in a block. Clients interested
495
483
// in transactions included in blocks can subscribe to the BlockConnected
496
484
// notification.
497
- m_signals ->TransactionRemovedFromMempool (it->GetSharedTx (), reason, mempool_sequence);
485
+ m_opts. signals ->TransactionRemovedFromMempool (it->GetSharedTx (), reason, mempool_sequence);
498
486
}
499
487
TRACE5 (mempool, removed,
500
488
it->GetTx ().GetHash ().data (),
@@ -645,18 +633,18 @@ void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigne
645
633
removeConflicts (*tx);
646
634
ClearPrioritisation (tx->GetHash ());
647
635
}
648
- if (m_signals ) {
649
- m_signals ->MempoolTransactionsRemovedForBlock (txs_removed_for_block, nBlockHeight);
636
+ if (m_opts. signals ) {
637
+ m_opts. signals ->MempoolTransactionsRemovedForBlock (txs_removed_for_block, nBlockHeight);
650
638
}
651
639
lastRollingFeeUpdate = GetTime ();
652
640
blockSinceLastRollingFeeBump = true ;
653
641
}
654
642
655
643
void CTxMemPool::check (const CCoinsViewCache& active_coins_tip, int64_t spendheight) const
656
644
{
657
- if (m_check_ratio == 0 ) return ;
645
+ if (m_opts. check_ratio == 0 ) return ;
658
646
659
- if (GetRand (m_check_ratio ) >= 1 ) return ;
647
+ if (GetRand (m_opts. check_ratio ) >= 1 ) return ;
660
648
661
649
AssertLockHeld (::cs_main);
662
650
LOCK (cs);
@@ -1108,12 +1096,12 @@ CFeeRate CTxMemPool::GetMinFee(size_t sizelimit) const {
1108
1096
rollingMinimumFeeRate = rollingMinimumFeeRate / pow (2.0 , (time - lastRollingFeeUpdate) / halflife);
1109
1097
lastRollingFeeUpdate = time;
1110
1098
1111
- if (rollingMinimumFeeRate < (double )m_incremental_relay_feerate .GetFeePerK () / 2 ) {
1099
+ if (rollingMinimumFeeRate < (double )m_opts. incremental_relay_feerate .GetFeePerK () / 2 ) {
1112
1100
rollingMinimumFeeRate = 0 ;
1113
1101
return CFeeRate (0 );
1114
1102
}
1115
1103
}
1116
- return std::max (CFeeRate (llround (rollingMinimumFeeRate)), m_incremental_relay_feerate );
1104
+ return std::max (CFeeRate (llround (rollingMinimumFeeRate)), m_opts. incremental_relay_feerate );
1117
1105
}
1118
1106
1119
1107
void CTxMemPool::trackPackageRemoved (const CFeeRate& rate) {
@@ -1137,7 +1125,7 @@ void CTxMemPool::TrimToSize(size_t sizelimit, std::vector<COutPoint>* pvNoSpends
1137
1125
// to have 0 fee). This way, we don't allow txn to enter mempool with feerate
1138
1126
// equal to txn which were removed with no block in between.
1139
1127
CFeeRate removed (it->GetModFeesWithDescendants (), it->GetSizeWithDescendants ());
1140
- removed += m_incremental_relay_feerate ;
1128
+ removed += m_opts. incremental_relay_feerate ;
1141
1129
trackPackageRemoved (removed);
1142
1130
maxFeeRateRemoved = std::max (maxFeeRateRemoved, removed);
1143
1131
0 commit comments