Handle over-sized (in virtual bytes) packages with no in-mempool ancestors

pull/28471/head
Greg Sanders 1 year ago
parent bc013fe8e3
commit 1a579f9d01

@ -200,6 +200,23 @@ bool CTxMemPool::CheckPackageLimits(const Package& package,
const int64_t total_vsize,
std::string &errString) const
{
size_t pack_count = package.size();
// Package itself is busting mempool limits; should be rejected even if no staged_ancestors exist
if (pack_count > static_cast<uint64_t>(m_limits.ancestor_count)) {
errString = strprintf("package count %u exceeds ancestor count limit [limit: %u]", pack_count, m_limits.ancestor_count);
return false;
} else if (pack_count > static_cast<uint64_t>(m_limits.descendant_count)) {
errString = strprintf("package count %u exceeds descendant count limit [limit: %u]", pack_count, m_limits.descendant_count);
return false;
} else if (total_vsize > m_limits.ancestor_size_vbytes) {
errString = strprintf("package size %u exceeds ancestor size limit [limit: %u]", total_vsize, m_limits.ancestor_size_vbytes);
return false;
} else if (total_vsize > m_limits.descendant_size_vbytes) {
errString = strprintf("package size %u exceeds descendant size limit [limit: %u]", total_vsize, m_limits.descendant_size_vbytes);
return false;
}
CTxMemPoolEntry::Parents staged_ancestors;
for (const auto& tx : package) {
for (const auto& input : tx->vin) {

Loading…
Cancel
Save