Skip to content

Commit

Permalink
Comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed May 15, 2024
1 parent 1d7943e commit 76aca8d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/chasers/chaser_snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ code chaser_snapshot::start() NOEXCEPT
if (enabled_bytes_)
bytes_ = archive().store_body_size();

// TODO: std::max(archive().get_top_confirmed(), config().top_bypass()).
// TODO: this will ensure the period does not start until it is costly.
if (enabled_valid_)
valid_ = archive().get_top_confirmed();

Expand Down Expand Up @@ -185,6 +187,7 @@ bool chaser_snapshot::update_bytes() NOEXCEPT

bool chaser_snapshot::update_valid(height_t height) NOEXCEPT
{
// The difference may be negative and therefore show zero growth (ok).
const auto growth = floored_subtract(height, valid_);
const auto sufficient = (growth >= snapshot_valid_);
valid_ = sufficient ? height : valid_;
Expand Down

0 comments on commit 76aca8d

Please sign in to comment.