From b261d9207ba5cdc0334fab403204971f79b6ca03 Mon Sep 17 00:00:00 2001 From: Thomas Winget Date: Fri, 26 Sep 2014 01:01:58 -0400 Subject: DNS checkpoint updating added, and daemon flag to enforce them The daemon should now check for updated checkpoints from checkpoints.moneropulse.org as well as from the configured json file every ~1hr (and on launch). The daemon now has a flag to enable enforcing these checkpoints (rather than just printing a warning when they fail). TODO: an easily configurable list of DNS servers to check for checkpoints as opposed to the hard-coded "checkpoints.moneropulse.org" --- src/cryptonote_core/cryptonote_core.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (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 7586421b3..1dbc7bf52 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -54,7 +54,9 @@ namespace cryptonote m_miner(this), m_miner_address(boost::value_initialized()), m_starter_message_showed(false), - m_target_blockchain_height(0) + m_target_blockchain_height(0), + m_checkpoints_path(""), + m_last_checkpoints_update(0) { set_cryptonote_protocol(pprotocol); } @@ -69,21 +71,27 @@ 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::set_enforce_dns_checkpoints(bool enforce_dns) + { + m_blockchain_storage.set_enforce_dns_checkpoints(enforce_dns); + } //----------------------------------------------------------------------------------------------- - void core::update_checkpoints() + bool core::update_checkpoints() { + bool res = true; if (time(NULL) - m_last_checkpoints_update >= 3600) { - m_blockchain_storage.update_checkpoints(m_checkpoints_path); + res = m_blockchain_storage.update_checkpoints(m_checkpoints_path); m_last_checkpoints_update = time(NULL); } + return res; } //----------------------------------------------------------------------------------- void core::init_options(boost::program_options::options_description& /*desc*/) -- cgit v1.2.3