From 1168e8d5d529069093aee652472fd8ca9a8c533c Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Thu, 20 Sep 2018 13:31:45 +0000 Subject: cryptonote_core: warn when the block rate deviates from expectations The warning threshold is set to allow a false positive every ten days on average. --- src/cryptonote_core/blockchain.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/cryptonote_core/blockchain.cpp') diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 57c4a8133..ee57c9430 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -900,6 +900,15 @@ difficulty_type Blockchain::get_difficulty_for_next_block() return diff; } //------------------------------------------------------------------ +std::vector Blockchain::get_last_block_timestamps(unsigned int blocks) const +{ + std::vector 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. -- cgit v1.2.3