diff --git a/nano/node/active_transactions.cpp b/nano/node/active_transactions.cpp index 2ca075d9..8ba96777 100644 --- a/nano/node/active_transactions.cpp +++ b/nano/node/active_transactions.cpp @@ -997,7 +997,7 @@ void nano::active_transactions::add_inactive_votes_cache (nano::block_hash const bool start_bootstrap (inactive_votes_bootstrap_check (representative_vector, hash_a, confirmed)); auto & inactive_by_arrival (inactive_votes_cache.get ()); inactive_by_arrival.emplace (nano::inactive_cache_information{ std::chrono::steady_clock::now (), hash_a, representative_vector, start_bootstrap, confirmed }); - if (inactive_votes_cache.size () > inactive_votes_cache_max) + if (inactive_votes_cache.size () > node.flags.inactive_votes_cache_size) { inactive_by_arrival.erase (inactive_by_arrival.begin ()); } diff --git a/nano/node/active_transactions.hpp b/nano/node/active_transactions.hpp index ac99181d..82c31932 100644 --- a/nano/node/active_transactions.hpp +++ b/nano/node/active_transactions.hpp @@ -202,7 +202,6 @@ private: mi::member>>>; ordered_cache inactive_votes_cache; // clang-format on - static size_t constexpr inactive_votes_cache_max{ 16 * 1024 }; bool inactive_votes_bootstrap_check (std::vector const &, nano::block_hash const &, bool &); static size_t constexpr dropped_elections_cache_max{ 32 * 1024 }; boost::thread thread; diff --git a/nano/node/cli.cpp b/nano/node/cli.cpp index c7cc0f75..a04eca75 100644 --- a/nano/node/cli.cpp +++ b/nano/node/cli.cpp @@ -100,7 +100,8 @@ void nano::add_node_flag_options (boost::program_options::options_description & ("batch_size", boost::program_options::value(), "Increase sideband batch size, default 512") ("block_processor_batch_size", boost::program_options::value(), "Increase block processor transaction batch write size, default 0 (limited by config block_processor_batch_max_time), 256k for fast_bootstrap") ("block_processor_full_size", boost::program_options::value(), "Increase block processor allowed blocks queue size before dropping live network packets and holding bootstrap download, default 65536, 1 million for fast_bootstrap") - ("block_processor_verification_size", boost::program_options::value(), "Increase batch signature verification size in block processor, default 0 (limited by config signature_checker_threads), unlimited for fast_bootstrap"); + ("block_processor_verification_size", boost::program_options::value(), "Increase batch signature verification size in block processor, default 0 (limited by config signature_checker_threads), unlimited for fast_bootstrap") + ("inactive_votes_cache_size", boost::program_options::value(), "Increase cached votes without active elections size, default 16384"); // clang-format on } @@ -154,6 +155,11 @@ std::error_code nano::update_flags (nano::node_flags & flags_a, boost::program_o { flags_a.block_processor_verification_size = block_processor_verification_size_it->second.as (); } + auto inactive_votes_cache_size_it = vm.find ("inactive_votes_cache_size"); + if (inactive_votes_cache_size_it != vm.end ()) + { + flags_a.inactive_votes_cache_size = inactive_votes_cache_size_it->second.as (); + } return ec; } diff --git a/nano/node/nodeconfig.hpp b/nano/node/nodeconfig.hpp index fdd49772..b38a7129 100644 --- a/nano/node/nodeconfig.hpp +++ b/nano/node/nodeconfig.hpp @@ -136,5 +136,6 @@ public: size_t block_processor_batch_size{ 0 }; size_t block_processor_full_size{ 65536 }; size_t block_processor_verification_size{ 0 }; + size_t inactive_votes_cache_size{ 16 * 1024 }; }; }