Skip to content

Commit

Permalink
Merge pull request #727 from evoskuil/master
Browse files Browse the repository at this point in the history
Fix stall, style.
  • Loading branch information
evoskuil authored Feb 1, 2025
2 parents 669f38e + 6d4ae8f commit 4016527
Showing 1 changed file with 31 additions and 27 deletions.
58 changes: 31 additions & 27 deletions src/chasers/chaser_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 4016527

Please sign in to comment.