From 30caebfce3a2445b809125a541cc9958b07d02f5 Mon Sep 17 00:00:00 2001 From: Thomas Winget Date: Thu, 25 Sep 2014 01:15:28 -0400 Subject: reload checkpoints file every ~hr and print if any fail also some other minor bug squashing and code formatting --- src/cryptonote_core/cryptonote_core.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/cryptonote_core/cryptonote_core.cpp') diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 964d61e2f..7586421b3 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -69,6 +69,21 @@ namespace cryptonote void core::set_checkpoints(checkpoints&& chk_pts) { m_blockchain_storage.set_checkpoints(std::move(chk_pts)); + m_last_checkpoints_update = time(NULL); + } + //----------------------------------------------------------------------------------- + void core::set_checkpoints_file_path(const std::string& path) + { + m_checkpoints_path = path; + } + //----------------------------------------------------------------------------------------------- + void core::update_checkpoints() + { + if (time(NULL) - m_last_checkpoints_update >= 3600) + { + m_blockchain_storage.update_checkpoints(m_checkpoints_path); + m_last_checkpoints_update = time(NULL); + } } //----------------------------------------------------------------------------------- void core::init_options(boost::program_options::options_description& /*desc*/) @@ -418,6 +433,7 @@ namespace cryptonote //----------------------------------------------------------------------------------------------- bool core::handle_incoming_block(const blobdata& block_blob, block_verification_context& bvc, bool update_miner_blocktemplate) { + update_checkpoints(); bvc = boost::value_initialized(); if(block_blob.size() > get_max_block_size()) { -- cgit v1.2.3