Delay inactive/gap cache bootstrap start for 30 seconds (#2631)

instead of 5 seconds. To allow more frequent new blocks arrival with realtime network & kess usage for expensive bootstrap
This commit is contained in:
Sergey Kroshnin 2020-03-12 17:31:08 +03:00 committed by GitHub
commit 7dcb20b076
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View file

@ -975,11 +975,10 @@ bool nano::active_transactions::inactive_votes_bootstrap_check (std::vector<nano
{
start_bootstrap = true;
}
if (start_bootstrap)
if (start_bootstrap && !node.ledger.block_exists (hash_a))
{
auto node_l (node.shared ());
auto now (std::chrono::steady_clock::now ());
node.alarm.add (node_l->network_params.network.is_test_network () ? now + std::chrono::milliseconds (5) : now + std::chrono::seconds (5), [node_l, hash_a]() {
node.alarm.add (std::chrono::steady_clock::now () + node.network_params.bootstrap.gap_cache_bootstrap_start_interval, [node_l, hash_a]() {
auto transaction (node_l->store.tx_begin_read ());
if (!node_l->store.block_exists (transaction, hash_a))
{

View file

@ -86,11 +86,10 @@ bool nano::gap_cache::bootstrap_check (std::vector<nano::account> const & voters
{
start_bootstrap = true;
}
if (start_bootstrap)
if (start_bootstrap && !node.ledger.block_exists (hash_a))
{
auto node_l (node.shared ());
auto now (std::chrono::steady_clock::now ());
node.alarm.add (node_l->network_params.network.is_test_network () ? now + std::chrono::milliseconds (5) : now + std::chrono::seconds (5), [node_l, hash_a]() {
node.alarm.add (std::chrono::steady_clock::now () + node.network_params.bootstrap.gap_cache_bootstrap_start_interval, [node_l, hash_a]() {
auto transaction (node_l->store.tx_begin_read ());
if (!node_l->store.block_exists (transaction, hash_a))
{

View file

@ -158,6 +158,7 @@ nano::bootstrap_constants::bootstrap_constants (nano::network_constants & networ
frontier_retry_limit = network_constants.is_test_network () ? 2 : 16;
lazy_retry_limit = network_constants.is_test_network () ? 2 : frontier_retry_limit * 10;
lazy_destinations_retry_limit = network_constants.is_test_network () ? 1 : frontier_retry_limit / 4;
gap_cache_bootstrap_start_interval = network_constants.is_test_network () ? std::chrono::milliseconds (5) : std::chrono::milliseconds (30 * 1000);
}
/* Convenience constants for core_test which is always on the test network */

View file

@ -455,6 +455,7 @@ public:
unsigned frontier_retry_limit;
unsigned lazy_retry_limit;
unsigned lazy_destinations_retry_limit;
std::chrono::milliseconds gap_cache_bootstrap_start_interval;
};
/** Constants whose value depends on the active network */