blockchain: rework loop to match the original code in complete_timestamps_vector
This commit is contained in:
parent
4707ccf1c3
commit
d16611360d
|
@ -1119,11 +1119,13 @@ bool Blockchain::complete_timestamps_vector(uint64_t start_top_height, std::vect
|
||||||
size_t need_elements = BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW - timestamps.size();
|
size_t need_elements = BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW - timestamps.size();
|
||||||
CHECK_AND_ASSERT_MES(start_top_height < m_db->height(), false, "internal error: passed start_height not < " << " m_db->height() -- " << start_top_height << " >= " << m_db->height());
|
CHECK_AND_ASSERT_MES(start_top_height < m_db->height(), false, "internal error: passed start_height not < " << " m_db->height() -- " << start_top_height << " >= " << m_db->height());
|
||||||
size_t stop_offset = start_top_height > need_elements ? start_top_height - need_elements : 0;
|
size_t stop_offset = start_top_height > need_elements ? start_top_height - need_elements : 0;
|
||||||
while (start_top_height != stop_offset)
|
do
|
||||||
{
|
{
|
||||||
timestamps.push_back(m_db->get_block_timestamp(start_top_height));
|
timestamps.push_back(m_db->get_block_timestamp(start_top_height));
|
||||||
|
if (start_top_height == 0)
|
||||||
|
break;
|
||||||
--start_top_height;
|
--start_top_height;
|
||||||
}
|
} while (start_top_height != stop_offset);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue