From 08890a4f88672107c1039c85c03122006270f590 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sun, 12 Jul 2026 18:32:38 -0400 Subject: [PATCH] Re-enable batch leakage (faster). --- .../bitcoin/node/chasers/chaser_validate.hpp | 2 +- src/chasers/chaser_validate_batch.cpp | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/include/bitcoin/node/chasers/chaser_validate.hpp b/include/bitcoin/node/chasers/chaser_validate.hpp index 667e2ea3..4686b4b5 100644 --- a/include/bitcoin/node/chasers/chaser_validate.hpp +++ b/include/bitcoin/node/chasers/chaser_validate.hpp @@ -154,7 +154,7 @@ class BCN_API chaser_validate std::atomic_bool disk_recovering_{}; std::atomic_bool window_archived_{}; std::atomic_bool maximum_posted_{}; - std::atomic_bool verifying_{}; + ////std::atomic_bool verifying_{}; std::atomic_bool draining_{}; atomic_counter writers_{}; counters counters_{}; diff --git a/src/chasers/chaser_validate_batch.cpp b/src/chasers/chaser_validate_batch.cpp index cb9415fa..a4b89ee4 100644 --- a/src/chasers/chaser_validate_batch.cpp +++ b/src/chasers/chaser_validate_batch.cpp @@ -77,7 +77,7 @@ void chaser_validate::process_batch(bool residual) NOEXCEPT } // Divert paused/new arrivals to inline for the verify duration. - verifying_.store(true); + ////verifying_.store(true); // Batch tables are now quiescent (no writers admitted, none in flight). // ======================================================================== @@ -85,13 +85,13 @@ void chaser_validate::process_batch(bool residual) NOEXCEPT // Retest under the claim, another drain may have just emptied the tables. if (!is_mature(residual)) { - verifying_.store(false); + ////verifying_.store(false); draining_.store(false); return; } const auto ec = do_process_batch(false); - verifying_.store(false); + ////verifying_.store(false); draining_.store(false); if (ec == network::error::operation_canceled) return; @@ -269,8 +269,8 @@ std::string chaser_validate::log_rate(const std::string& name, bool chaser_validate::enter_capture() NOEXCEPT { - // Wait out a pending batch cutoff (brief, bounded by in-flight captures), - // then capture. Divert to inline only during verify. +#if defined(DISABLED) + // Blocked by batch (also requires other verifying_ enabled). while (true) { ++writers_; @@ -283,6 +283,17 @@ bool chaser_validate::enter_capture() NOEXCEPT std::this_thread::yield(); } +#else + // Bypassed by batch (faster overall, but high bypass). + ++writers_; + if (draining_.load()) + { + --writers_; + return false; + } + + return true; +#endif } void chaser_validate::exit_capture() NOEXCEPT