diff options
author | xiphon <xiphon@protonmail.com> | 2020-04-20 18:42:10 +0000 |
---|---|---|
committer | xiphon <xiphon@protonmail.com> | 2020-04-20 18:56:22 +0000 |
commit | a813c46a1b83a37ba3acaa93ba10bb98b05f9c67 (patch) | |
tree | ae4b772db11cee4868a1532d0a95d831ff7f95c2 | |
parent | Merge pull request #6397 (diff) | |
download | monero-a813c46a1b83a37ba3acaa93ba10bb98b05f9c67.tar.xz |
cryptonote_core: skip dns checkpoints on startup if not enforced
-rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 7 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_core.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 7fb232ad2..957ca9439 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -263,14 +263,14 @@ namespace cryptonote m_blockchain_storage.set_enforce_dns_checkpoints(enforce_dns); } //----------------------------------------------------------------------------------------------- - bool core::update_checkpoints() + bool core::update_checkpoints(const bool skip_dns /* = false */) { if (m_nettype != MAINNET || m_disable_dns_checkpoints) return true; if (m_checkpoints_updating.test_and_set()) return true; bool res = true; - if (time(NULL) - m_last_dns_checkpoints_update >= 3600) + if (!skip_dns && time(NULL) - m_last_dns_checkpoints_update >= 3600) { res = m_blockchain_storage.update_checkpoints(m_checkpoints_path, true); m_last_dns_checkpoints_update = time(NULL); @@ -669,7 +669,8 @@ namespace cryptonote // load json & DNS checkpoints, and verify them // with respect to what blocks we already have - CHECK_AND_ASSERT_MES(update_checkpoints(), false, "One or more checkpoints loaded from json or dns conflicted with existing checkpoints."); + const bool skip_dns_checkpoints = !command_line::get_arg(vm, arg_dns_checkpoints); + CHECK_AND_ASSERT_MES(update_checkpoints(skip_dns_checkpoints), false, "One or more checkpoints loaded from json or dns conflicted with existing checkpoints."); // DNS versions checking if (check_updates_string == "disabled") diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index 79a846de1..3b7e3720f 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -697,7 +697,7 @@ namespace cryptonote * * @note see Blockchain::update_checkpoints() */ - bool update_checkpoints(); + bool update_checkpoints(const bool skip_dns = false); /** * @brief tells the daemon to wind down operations and stop running |