Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions include/bitcoin/node/impl/chasers/chaser_organize.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,15 @@ void CLASS::do_organize(typename Block::cptr block, bool prioritized,
// Checking currency before notify also avoids excessive work backlog.
if (is_block() || current)
{
if (!bumped_)
if (!bumped_ || regress)
{
// If at start the fork point is top of both chains, and next candidate
// is already downloaded, then new header will arrive and download will
// be skipped, resulting in stall until restart at which time the start
// event will advance through all downloaded candidates and progress on
// arrivals. This bumps validation once for current strong headers.
// arrivals. This bumps validation once for current strong headers, and
// again on regression, as the candidate above the branch point may
// already be downloaded when reorganizing back to a stored branch.
notify(error::success, chase::bump, add1(branch_point));
bumped_ = true;
}
Expand Down
11 changes: 7 additions & 4 deletions src/chasers/chaser_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,15 @@ void chaser_check::do_regressed(height_t branch_point) NOEXCEPT
{
BC_ASSERT(stranded());

// Inconsequential regression, work isn't there yet.
if (branch_point >= position())
// Inconsequential regression, neither position nor window is there yet.
if (branch_point >= std::max(position(), requested_))
return;

// Update position, purge outstanding work, and wait on track completion.
set_position(branch_point);
// Update position and window, purge outstanding work, and wait on track
// completion. The window must follow the position or the gap it awaits
// is never requested.
set_position(std::min(branch_point, position()));
requested_ = advanced_ = position();
stop_tracking();
maps_.clear();
notify(error::success, chase::purge, branch_point);
Expand Down