aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cryptonote_core/blockchain_storage.cpp3
-rw-r--r--src/cryptonote_core/blockchain_storage.h1
-rw-r--r--src/cryptonote_core/checkpoints_create.cpp17
-rw-r--r--src/cryptonote_core/checkpoints_create.h2
4 files changed, 19 insertions, 4 deletions
diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp
index e2b6f2326..35819dd3c 100644
--- a/src/cryptonote_core/blockchain_storage.cpp
+++ b/src/cryptonote_core/blockchain_storage.cpp
@@ -87,6 +87,7 @@ bool blockchain_storage::init(const std::string& config_folder, bool testnet)
{
CRITICAL_REGION_LOCAL(m_blockchain_lock);
m_config_folder = config_folder;
+ m_testnet = testnet;
LOG_PRINT_L0("Loading blockchain...");
const std::string filename = m_config_folder + "/" CRYPTONOTE_BLOCKCHAINDATA_FILENAME;
if(tools::unserialize_obj_from_file(*this, filename))
@@ -1833,7 +1834,7 @@ bool blockchain_storage::update_checkpoints(const std::string& file_path, bool c
else if (check_dns)
{
checkpoints dns_points;
- cryptonote::load_checkpoints_from_dns(dns_points);
+ cryptonote::load_checkpoints_from_dns(dns_points, m_testnet);
if (m_checkpoints.check_for_conflicts(dns_points))
{
check_against_checkpoints(dns_points, false);
diff --git a/src/cryptonote_core/blockchain_storage.h b/src/cryptonote_core/blockchain_storage.h
index 1bfdf7bd0..55f54d13b 100644
--- a/src/cryptonote_core/blockchain_storage.h
+++ b/src/cryptonote_core/blockchain_storage.h
@@ -218,6 +218,7 @@ namespace cryptonote
std::atomic<bool> m_is_blockchain_storing;
bool m_enforce_dns_checkpoints;
+ bool m_testnet;
bool switch_to_alternative_blockchain(std::list<blocks_ext_by_hash::iterator>& alt_chain, bool discard_disconnected_chain);
bool pop_block_from_blockchain();
diff --git a/src/cryptonote_core/checkpoints_create.cpp b/src/cryptonote_core/checkpoints_create.cpp
index 31ae9655b..9a21baac5 100644
--- a/src/cryptonote_core/checkpoints_create.cpp
+++ b/src/cryptonote_core/checkpoints_create.cpp
@@ -112,7 +112,7 @@ bool load_checkpoints_from_json(cryptonote::checkpoints& checkpoints, std::strin
return true;
}
-bool load_checkpoints_from_dns(cryptonote::checkpoints& checkpoints)
+bool load_checkpoints_from_dns(cryptonote::checkpoints& checkpoints, bool testnet)
{
// All four MoneroPulse domains have DNSSEC on and valid
static const std::vector<std::string> dns_urls = { "checkpoints.moneropulse.se"
@@ -120,6 +120,12 @@ bool load_checkpoints_from_dns(cryptonote::checkpoints& checkpoints)
, "checkpoints.moneropulse.net"
, "checkpoints.moneropulse.co"
};
+
+ static const std::vector<std::string> testnet_dns_urls = { "testpoints.moneropulse.se"
+ , "testpoints.moneropulse.org"
+ , "testpoints.moneropulse.net"
+ , "testpoints.moneropulse.co"
+ };
bool avail, valid;
std::vector<std::string> records;
@@ -131,7 +137,14 @@ bool load_checkpoints_from_dns(cryptonote::checkpoints& checkpoints)
size_t cur_index = first_index;
do
{
- records = tools::DNSResolver::instance().get_txt_record(dns_urls[cur_index], avail, valid);
+ if (testnet)
+ {
+ records = tools::DNSResolver::instance().get_txt_record(testnet_dns_urls[cur_index], avail, valid);
+ }
+ else
+ {
+ records = tools::DNSResolver::instance().get_txt_record(dns_urls[cur_index], avail, valid);
+ }
if (records.size() == 0 || (avail && !valid))
{
cur_index++;
diff --git a/src/cryptonote_core/checkpoints_create.h b/src/cryptonote_core/checkpoints_create.h
index 569d437cf..8422e2b33 100644
--- a/src/cryptonote_core/checkpoints_create.h
+++ b/src/cryptonote_core/checkpoints_create.h
@@ -42,7 +42,7 @@ namespace cryptonote
bool create_checkpoints(cryptonote::checkpoints& checkpoints);
bool load_checkpoints_from_json(cryptonote::checkpoints& checkpoints, std::string json_hashfile_fullpath);
- bool load_checkpoints_from_dns(cryptonote::checkpoints& checkpoints);
+ bool load_checkpoints_from_dns(cryptonote::checkpoints& checkpoints, bool testnet = false);
bool load_new_checkpoints(cryptonote::checkpoints& checkpoints, std::string json_hashfile_fullpath);
} // namespace cryptonote