This commit is contained in:
Luke Dashjr 2025-04-28 18:35:10 +02:00 committed by GitHub
commit 444de228f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -311,6 +311,7 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
// close to full; this is just a simple heuristic to finish quickly if the // close to full; this is just a simple heuristic to finish quickly if the
// mempool has a lot of entries. // mempool has a lot of entries.
const int64_t MAX_CONSECUTIVE_FAILURES = 1000; const int64_t MAX_CONSECUTIVE_FAILURES = 1000;
constexpr int32_t BLOCK_FULL_ENOUGH_WEIGHT_DELTA = 4000;
int64_t nConsecutiveFailed = 0; int64_t nConsecutiveFailed = 0;
while (mi != mempool.mapTx.get<ancestor_score>().end() || !mapModifiedTx.empty()) { while (mi != mempool.mapTx.get<ancestor_score>().end() || !mapModifiedTx.empty()) {
@ -392,7 +393,7 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
++nConsecutiveFailed; ++nConsecutiveFailed;
if (nConsecutiveFailed > MAX_CONSECUTIVE_FAILURES && nBlockWeight > if (nConsecutiveFailed > MAX_CONSECUTIVE_FAILURES && nBlockWeight >
m_options.nBlockMaxWeight - m_options.block_reserved_weight) { m_options.nBlockMaxWeight - BLOCK_FULL_ENOUGH_WEIGHT_DELTA) {
// Give up if we're close to full and haven't succeeded in a while // Give up if we're close to full and haven't succeeded in a while
break; break;
} }