aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/cryptonote_core.cpp
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2014-09-26 01:01:58 -0400
committerThomas Winget <tewinget@gmail.com>2014-09-30 16:21:37 -0400
commitb261d9207ba5cdc0334fab403204971f79b6ca03 (patch)
treeb113fc0deb913b3e27be1d33f60daa62a52462b4 /src/cryptonote_core/cryptonote_core.cpp
parent30caebfce3a2445b809125a541cc9958b07d02f5 (diff)
downloadmonzero-core-b261d9207ba5cdc0334fab403204971f79b6ca03.tar.gz
monzero-core-b261d9207ba5cdc0334fab403204971f79b6ca03.tar.xz
monzero-core-b261d9207ba5cdc0334fab403204971f79b6ca03.zip
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"
Diffstat (limited to 'src/cryptonote_core/cryptonote_core.cpp')
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp16
1 files changed, 12 insertions, 4 deletions
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<account_public_address>()),
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*/)