From 38756d00ff432dd44971538c512465e19438f3ff Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 26 Jul 2017 10:18:44 +0100 Subject: [PATCH] core: new API to disable DNS checkpoint lookups --- src/cryptonote_core/cryptonote_core.cpp | 3 ++- src/cryptonote_core/cryptonote_core.h | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 75d5f7a1..a4df27cd 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -77,6 +77,7 @@ namespace cryptonote m_checkpoints_path(""), m_last_dns_checkpoints_update(0), m_last_json_checkpoints_update(0), + m_disable_dns_checkpoints(false), m_threadpool(tools::thread_group::optimal()), m_update_download(0) { @@ -108,7 +109,7 @@ namespace cryptonote //----------------------------------------------------------------------------------------------- bool core::update_checkpoints() { - if (m_testnet || m_fakechain) return true; + if (m_testnet || m_fakechain || m_disable_dns_checkpoints) return true; if (m_checkpoints_updating.test_and_set()) return true; diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index 4dbd5104..171c3cb9 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -406,6 +406,13 @@ namespace cryptonote */ void set_enforce_dns_checkpoints(bool enforce_dns); + /** + * @brief set whether or not to enable or disable DNS checkpoints + * + * @param disble whether to disable DNS checkpoints + */ + void disable_dns_checkpoints(bool disable = true) { m_disable_dns_checkpoints = disable; } + /** * @copydoc tx_memory_pool::have_tx * @@ -882,6 +889,7 @@ namespace cryptonote time_t m_last_json_checkpoints_update; //!< time when json checkpoints were last updated std::atomic_flag m_checkpoints_updating; //!< set if checkpoints are currently updating to avoid multiple threads attempting to update at once + bool m_disable_dns_checkpoints; size_t block_sync_size;