diff options
author | Thomas Winget <tewinget@gmail.com> | 2014-09-25 01:15:28 -0400 |
---|---|---|
committer | Thomas Winget <tewinget@gmail.com> | 2014-09-30 16:21:37 -0400 |
commit | 30caebfce3a2445b809125a541cc9958b07d02f5 (patch) | |
tree | 64b640979d79d553dd3be7554154373afd7e98e4 /src/cryptonote_core/cryptonote_core.cpp | |
parent | updated DNSResolver/things that use it for DNSSEC (diff) | |
download | monero-30caebfce3a2445b809125a541cc9958b07d02f5.tar.xz |
reload checkpoints file every ~hr and print if any fail
also some other minor bug squashing and code formatting
Diffstat (limited to 'src/cryptonote_core/cryptonote_core.cpp')
-rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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<block_verification_context>(); if(block_blob.size() > get_max_block_size()) { |