@@ -196,25 +196,20 @@ util::Result<CTxMemPool::setEntries> CTxMemPool::CalculateAncestorsAndCheckLimit
196196 return ancestors;
197197}
198198
199- bool CTxMemPool::CheckPackageLimits (const Package& package,
200- const int64_t total_vsize,
201- std::string &errString) const
199+ util::Result<void > CTxMemPool::CheckPackageLimits (const Package& package,
200+ const int64_t total_vsize) const
202201{
203202 size_t pack_count = package.size ();
204203
205204 // Package itself is busting mempool limits; should be rejected even if no staged_ancestors exist
206205 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 ;
206+ return util::Error{Untranslated (strprintf (" package count %u exceeds ancestor count limit [limit: %u]" , pack_count, m_limits.ancestor_count ))};
209207 } 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 ;
208+ return util::Error{Untranslated (strprintf (" package count %u exceeds descendant count limit [limit: %u]" , pack_count, m_limits.descendant_count ))};
212209 } 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 ;
210+ return util::Error{Untranslated (strprintf (" package size %u exceeds ancestor size limit [limit: %u]" , total_vsize, m_limits.ancestor_size_vbytes ))};
215211 } 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 ;
212+ return util::Error{Untranslated (strprintf (" package size %u exceeds descendant size limit [limit: %u]" , total_vsize, m_limits.descendant_size_vbytes ))};
218213 }
219214
220215 CTxMemPoolEntry::Parents staged_ancestors;
@@ -224,8 +219,7 @@ bool CTxMemPool::CheckPackageLimits(const Package& package,
224219 if (piter) {
225220 staged_ancestors.insert (**piter);
226221 if (staged_ancestors.size () + package.size () > static_cast <uint64_t >(m_limits.ancestor_count )) {
227- errString = strprintf (" too many unconfirmed parents [limit: %u]" , m_limits.ancestor_count );
228- return false ;
222+ return util::Error{Untranslated (strprintf (" too many unconfirmed parents [limit: %u]" , m_limits.ancestor_count ))};
229223 }
230224 }
231225 }
@@ -236,8 +230,8 @@ bool CTxMemPool::CheckPackageLimits(const Package& package,
236230 const auto ancestors{CalculateAncestorsAndCheckLimits (total_vsize, package.size (),
237231 staged_ancestors, m_limits)};
238232 // It's possible to overestimate the ancestor/descendant totals.
239- if (!ancestors.has_value ()) errString = " possibly " + util::ErrorString (ancestors).original ;
240- return ancestors. has_value () ;
233+ if (!ancestors.has_value ()) return util::Error{ Untranslated ( " possibly " + util::ErrorString (ancestors).original )} ;
234+ return {} ;
241235}
242236
243237util::Result<CTxMemPool::setEntries> CTxMemPool::CalculateMemPoolAncestors (
0 commit comments