1
0
Fork 0
forked from lthn/blockchain

don't populate cache in get_last_n_blocks_timestamps_median() if the resulted num of blocks isn't equal to window size

This commit is contained in:
sowle 2024-10-24 14:44:15 +02:00
parent a58c0810fb
commit f7e64b9164
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC

View file

@ -5709,7 +5709,8 @@ uint64_t blockchain_storage::get_last_n_blocks_timestamps_median(size_t n) const
std::vector<uint64_t> timestamps = get_last_n_blocks_timestamps(n);
uint64_t median_res = epee::misc_utils::median(timestamps);
m_timestamps_median_cache[n] = median_res;
if (timestamps.size() == n)
m_timestamps_median_cache[n] = median_res;
return median_res;
}
//------------------------------------------------------------------