mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 19:08:53 +00:00
DNS checkpoint loading for testnet should now be correct
This commit is contained in:
parent
52f9629bd7
commit
9dab105e2e
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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++;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user