From a54c00e823137bf2c06c1672d0fe3e8ae3e11cf9 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Thu, 13 Mar 2025 17:36:53 +0400 Subject: [PATCH] changed order of warming up(to have most recent blocks as most recent cache) --- src/currency_core/blockchain_storage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 675682cf..0c4ed2a2 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -5338,7 +5338,7 @@ void blockchain_storage::do_full_db_warm_up() const uint64_t ticks_last_print = 0; uint64_t current_sz = get_current_blockchain_size(); LOG_PRINT_CYAN("Warming up starting, total blocks..." << current_sz, LOG_LEVEL_0); - for (uint64_t i = current_sz - 1; i != 0; --i) + for (uint64_t i = 1; i != current_sz; ++i) { CRITICAL_REGION_LOCAL(m_read_lock); auto blk_ptr = m_db_blocks[i]; @@ -5360,7 +5360,7 @@ void blockchain_storage::do_full_db_warm_up() const if (epee::misc_utils::get_tick_count() - ticks_last_print > 1000) { ticks_last_print = epee::misc_utils::get_tick_count(); - LOG_PRINT_CYAN("Warming up: " << ( ( (current_sz - i) * 100)/ current_sz) << "%, " << (current_sz - i) << " of " << current_sz, LOG_LEVEL_0); + LOG_PRINT_CYAN("Warming up: " << ( ( (i) * 100)/ current_sz) << "%, " << (i) << " of " << current_sz, LOG_LEVEL_0); #define PRINT_CONTAINER(cont_name) strm << #cont_name"[" << cont_name.get_cache_size() << "]:" << (cont_name.get_cacheed_items_count() * 100) / cont_name.get_cache_size() << " %, items: " << cont_name.get_cacheed_items_count() << ENDL