Add --skip_consistency_check flag (#4924)

This commit is contained in:
Piotr Wójcik 2025-07-08 19:40:20 +02:00 committed by GitHub
commit 3c2282e02a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -36,7 +36,7 @@ std::string nano::error_cli_messages::message (int ev) const
case nano::error_cli::reading_config:
return "Config file read error";
case nano::error_cli::ambiguous_pruning_voting_options:
return "Flag --enable_pruning and enable_voting in node config cannot be used together";
return "Flag --enable_pruning and --enable_voting in node config cannot be used together";
}
return "Invalid error code";
@ -127,6 +127,7 @@ void nano::add_node_flag_options (boost::program_options::options_description &
("inactive_votes_cache_size", boost::program_options::value<std::size_t>(), "Increase cached votes without active elections size, default 16384")
("vote_processor_capacity", boost::program_options::value<std::size_t>(), "Vote processor queue size before dropping votes, default 144k")
("disable_large_votes", boost::program_options::value<bool>(), "Disable large votes")
("skip_consistency_check", "Skip ledger consistency check on startup, this is not recommended and should only be used for testing or recovery purposes")
;
// clang-format on
}
@ -193,6 +194,10 @@ std::error_code nano::update_flags (nano::node_flags & flags_a, boost::program_o
nano::network::confirm_req_hashes_max = 7;
nano::network::confirm_ack_hashes_max = 12;
}
if (vm.contains ("skip_consistency_check"))
{
flags_a.generate_cache.consistency_check = false;
}
// Config overriding
auto config (vm.find ("config"));
if (config != vm.end ())

View file

@ -233,7 +233,11 @@ void nano::ledger::initialize (nano::generate_cache_flags const & generate_cache
if (generate_cache_flags.reps && generate_cache_flags.consistency_check)
{
logger.debug (nano::log::type::ledger, "Verifying total weights consistency...");
rep_weights.verify_consistency (static_cast<nano::uint128_t> (burned_balance));
logger.debug (nano::log::type::ledger, "Total weights consistency verified");
}
logger.info (nano::log::type::ledger, "Block count: {:>11}", cache.block_count.load ());