Remove debug_assert which is hit calling block_confirm (#3031)

This commit is contained in:
Wesley Shillingford 2020-11-04 20:56:10 +00:00 committed by GitHub
commit abfe2b05b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 19 deletions

View file

@ -529,19 +529,10 @@ void nano::confirmation_height_bounded::cement_blocks (nano::write_guard & scope
// Bail if there was an error. This indicates that there was a fatal issue with the ledger
// (the blocks probably got rolled back when they shouldn't have).
release_assert (!error);
// Tests should check this already at the end, but not all blocks may have elections (e.g from manual calls to confirmation_height_processor::add), this should catch any inconsistencies on live/beta though
if (!network_params.network.is_dev_network ())
if (!network_params.network.is_dev_network () && time_spent_cementing > maximum_batch_write_time)
{
auto blocks_confirmed_stats = ledger.stats.count (nano::stat::type::confirmation_height, nano::stat::detail::blocks_confirmed);
auto observer_stats = ledger.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::all, nano::stat::dir::out);
debug_assert (blocks_confirmed_stats == observer_stats);
// Lower batch_write_size if it took too long to write that amount.
if (time_spent_cementing > maximum_batch_write_time)
{
// Reduce (unless we have hit a floor)
batch_write_size = std::max<uint64_t> (minimum_batch_write_size, batch_write_size - amount_to_change);
}
// Reduce (unless we have hit a floor)
batch_write_size = std::max<uint64_t> (minimum_batch_write_size, batch_write_size - amount_to_change);
}
debug_assert (pending_writes.empty ());

View file

@ -405,13 +405,6 @@ void nano::confirmation_height_unbounded::cement_blocks (nano::write_guard & sco
notify_observers_callback (cemented_blocks);
release_assert (!error);
// Tests should check this already at the end, but not all blocks may have elections (e.g from manual calls to confirmation_height_processor::add), this should catch any inconsistencies on live/beta though
if (!network_params.network.is_dev_network ())
{
auto blocks_confirmed_stats = ledger.stats.count (nano::stat::type::confirmation_height, nano::stat::detail::blocks_confirmed);
auto observer_stats = ledger.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::all, nano::stat::dir::out);
debug_assert (blocks_confirmed_stats == observer_stats);
}
debug_assert (pending_writes.empty ());
debug_assert (pending_writes_size == 0);
timer.restart ();