Skip to content

Commit

Permalink
GH-2159 Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Mar 3, 2024
1 parent 71c5479 commit 59b3c17
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,12 @@ struct controller_impl {
: forkdb.fetch_branch( fork_db_head(forkdb, irreversible_mode())->id(), new_lib );
try {
auto should_process = [&](auto& bsp) {
// Only make irreversible blocks that have been validated. Blocks in the fork database may not be on our current best head
// and therefore have not been validated.
// An alternative more complex implementation would be to do a fork switch here and validate all blocks so they can be then made
// irreversible. Instead this moves irreversible as much as possible and allows the next maybe_switch_forks call to apply these
// non-validated blocks. After the maybe_switch_forks call (before next produced block or on next received block), irreversible
// can then move forward on the then validated blocks.
return read_mode == db_read_mode::IRREVERSIBLE || bsp->is_valid();
};

Expand Down

0 comments on commit 59b3c17

Please sign in to comment.