Merge pull request #4408

341b3931 cryptonote_core: warn when the block rate deviates from expectations (moneromooo-monero)
This commit is contained in:
Riccardo Spagni
2018-10-26 22:18:41 +02:00
4 changed files with 69 additions and 0 deletions
+9
View File
@@ -886,6 +886,15 @@ difficulty_type Blockchain::get_difficulty_for_next_block()
return diff;
}
//------------------------------------------------------------------
std::vector<time_t> Blockchain::get_last_block_timestamps(unsigned int blocks) const
{
std::vector<time_t> timestamps(blocks);
uint64_t height = m_db->height();
while (blocks--)
timestamps[blocks] = m_db->get_block_timestamp(height - blocks - 1);
return timestamps;
}
//------------------------------------------------------------------
// This function removes blocks from the blockchain until it gets to the
// position where the blockchain switch started and then re-adds the blocks
// that had been removed.