diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2829,14 +2829,6 @@ } } -static void LimitValidationInterfaceQueue() { - AssertLockNotHeld(cs_main); - - if (GetMainSignals().CallbacksPending() > 10) { - SyncWithValidationInterfaceQueue(); - } -} - /** * Make the best chain active, in multiple steps. The result is either failure * or an activated best chain. pblock is either nullptr or a pointer to a block @@ -2871,13 +2863,15 @@ do { boost::this_thread::interruption_point(); - // Block until the validation queue drains. This should largely - // never happen in normal operation, however may happen during - // reindex, causing memory blowup if we run too far ahead. - // Note that if a validationinterface callback ends up calling - // ActivateBestChain this may lead to a deadlock! We should - // probably have a DEBUG_LOCKORDER test for this in the future. - LimitValidationInterfaceQueue(); + if (GetMainSignals().CallbacksPending() > 10) { + // Block until the validation queue drains. This should largely + // never happen in normal operation, however may happen during + // reindex, causing memory blowup if we run too far ahead. + // Note that if a validationinterface callback ends up calling + // ActivateBestChain this may lead to a deadlock! We should + // probably have a DEBUG_LOCKORDER test for this in the future. + SyncWithValidationInterfaceQueue(); + } { LOCK(cs_main); @@ -3041,9 +3035,6 @@ break; } - // Make sure the queue of validation callbacks doesn't grow unboundedly. - LimitValidationInterfaceQueue(); - LOCK(cs_main); if (!chainActive.Contains(pindex)) {