From 6d4ae8f20b1cdbdccef612aa5700b7efe14a43ae Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sat, 1 Feb 2025 17:15:52 -0500 Subject: [PATCH] Fix stall, style. --- src/chasers/chaser_check.cpp | 58 +++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/src/chasers/chaser_check.cpp b/src/chasers/chaser_check.cpp index 5de0040fb..830ff2e02 100644 --- a/src/chasers/chaser_check.cpp +++ b/src/chasers/chaser_check.cpp @@ -148,33 +148,6 @@ bool chaser_check::handle_event(const code&, chase event_, return true; } -void chaser_check::do_confirmable(height_t height) NOEXCEPT -{ - BC_ASSERT(stranded()); - confirmed_ = height; - - if (confirmed_ == requested_) - do_headers(height_t{}); -} - -// regression -// ---------------------------------------------------------------------------- - -void chaser_check::do_regressed(height_t branch_point) NOEXCEPT -{ - BC_ASSERT(stranded()); - - // Inconsequential regression, work isn't there yet. - if (branch_point >= position()) - return; - - // Update position, purge outstanding work, and wait on track completion. - set_position(branch_point); - stop_tracking(); - maps_.clear(); - notify(error::success, chase::purge, branch_point); -} - void chaser_check::start_tracking() NOEXCEPT { // Called from start. @@ -211,9 +184,40 @@ void chaser_check::do_handle_purged(const code&) NOEXCEPT do_bump(height_t{}); } +// regression +// ---------------------------------------------------------------------------- + +void chaser_check::do_regressed(height_t branch_point) NOEXCEPT +{ + BC_ASSERT(stranded()); + + // Inconsequential regression, work isn't there yet. + if (branch_point >= position()) + return; + + // Update position, purge outstanding work, and wait on track completion. + set_position(branch_point); + stop_tracking(); + maps_.clear(); + notify(error::success, chase::purge, branch_point); +} + // track downloaded in order (to move download window) // ---------------------------------------------------------------------------- +void chaser_check::do_confirmable(height_t height) NOEXCEPT +{ + BC_ASSERT(stranded()); + + // Confirmations are ordered, but notification order isn't guaranteed. + if (confirmed_ > height) + confirmed_ = height; + + // The full set of requested hashes has been confirmed. + if (confirmed_ == requested_) + do_headers(height_t{}); +} + void chaser_check::do_checked(height_t height) NOEXCEPT { BC_ASSERT(stranded());