mirror of
https://git.wownero.com/wownero/wownero.git
synced 2025-01-08 21:28:52 +00:00
blockchain: fix off by one brought by the regtest mode fix
This commit is contained in:
parent
fb4c29b960
commit
41f7e77ca5
@ -3673,10 +3673,12 @@ bool Blockchain::update_next_cumulative_weight_limit(uint64_t *long_term_effecti
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const uint64_t nblocks = std::min<uint64_t>(m_long_term_block_weights_window, db_height - 1);
|
uint64_t nblocks = std::min<uint64_t>(m_long_term_block_weights_window, db_height);
|
||||||
|
if (nblocks == db_height)
|
||||||
|
--nblocks;
|
||||||
weights.resize(nblocks);
|
weights.resize(nblocks);
|
||||||
for (uint64_t h = 0; h < nblocks; ++h)
|
for (uint64_t h = 0; h < nblocks; ++h)
|
||||||
weights[h] = m_db->get_block_long_term_weight(db_height - nblocks + h);
|
weights[h] = m_db->get_block_long_term_weight(db_height - nblocks + h - 1);
|
||||||
new_weights = weights;
|
new_weights = weights;
|
||||||
long_term_median = epee::misc_utils::median(weights);
|
long_term_median = epee::misc_utils::median(weights);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user