aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-09-20 13:31:45 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-09-20 14:01:52 +0000
commit341b3931ed79dd0b16a04e8a1468179ba5dd22c2 (patch)
treee5a870feb7a5d123625490d5963bab7ce250810e /src/cryptonote_core/blockchain.cpp
parentMerge pull request #4391 (diff)
downloadmonero-341b3931ed79dd0b16a04e8a1468179ba5dd22c2.tar.xz
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.
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r--src/cryptonote_core/blockchain.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 3751d6473..e94024ae5 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -880,6 +880,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.