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:
parent
a58c0810fb
commit
f7e64b9164
1 changed files with 2 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue