File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,23 @@ bool CTxMemPool::CheckPackageLimits(const Package& package,
200
200
const int64_t total_vsize,
201
201
std::string &errString) const
202
202
{
203
+ size_t pack_count = package.size ();
204
+
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
+ errString = strprintf (" package count %u exceeds ancestor count limit [limit: %u]" , pack_count, m_limits.ancestor_count );
208
+ return false ;
209
+ } else if (pack_count > static_cast <uint64_t >(m_limits.descendant_count )) {
210
+ errString = strprintf (" package count %u exceeds descendant count limit [limit: %u]" , pack_count, m_limits.descendant_count );
211
+ return false ;
212
+ } else if (total_vsize > m_limits.ancestor_size_vbytes ) {
213
+ errString = strprintf (" package size %u exceeds ancestor size limit [limit: %u]" , total_vsize, m_limits.ancestor_size_vbytes );
214
+ return false ;
215
+ } else if (total_vsize > m_limits.descendant_size_vbytes ) {
216
+ errString = strprintf (" package size %u exceeds descendant size limit [limit: %u]" , total_vsize, m_limits.descendant_size_vbytes );
217
+ return false ;
218
+ }
219
+
203
220
CTxMemPoolEntry::Parents staged_ancestors;
204
221
for (const auto & tx : package) {
205
222
for (const auto & input : tx->vin ) {
You can’t perform that action at this time.
0 commit comments