Skip to content

Commit

Permalink
Set a 1,000 block validation backlog.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Oct 23, 2024
1 parent 4e7adc6 commit ed90b6f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/chasers/chaser_validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,17 @@ void chaser_validate::do_checked(height_t height) NOEXCEPT
do_bump(height);
}

constexpr auto validation_window = 1'000_size;

void chaser_validate::do_bump(height_t) NOEXCEPT
{
BC_ASSERT(stranded());
const auto& query = archive();

// Validate checked blocks starting immediately after last validated.
// Bypass until next event if validation backlog is full.
for (auto height = add1(position()); !closed(); ++height)
for (auto height = add1(position());
(validation_backlog_ < validation_window) && !closed(); ++height)
{
const auto link = query.to_candidate(height);
const auto ec = query.get_block_state(link);
Expand Down Expand Up @@ -268,6 +271,10 @@ void chaser_validate::complete_block(const code& ec, const header_link& link,
// Trigger confirmation now that validations are current.
if (is_current(link))
notify(ec, chase::valid, possible_wide_cast<height_t>(height));

// Prevent stall when window was full.
if (validation_backlog_ == sub1(validation_window))
do_bump(height_t{});
}

// neutrino
Expand Down

0 comments on commit ed90b6f

Please sign in to comment.