mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #8408
09a597b
wallet2: don't use DNS to obtain segregation heights (tobtoht)
This commit is contained in:
commit
4476c35fc8
1 changed files with 0 additions and 37 deletions
|
@ -14003,43 +14003,6 @@ uint64_t wallet2::get_segregation_fork_height() const
|
||||||
if (m_segregation_height > 0)
|
if (m_segregation_height > 0)
|
||||||
return m_segregation_height;
|
return m_segregation_height;
|
||||||
|
|
||||||
if (m_use_dns && !m_offline)
|
|
||||||
{
|
|
||||||
// All four MoneroPulse domains have DNSSEC on and valid
|
|
||||||
static const std::vector<std::string> dns_urls = {
|
|
||||||
"segheights.moneropulse.org",
|
|
||||||
"segheights.moneropulse.net",
|
|
||||||
"segheights.moneropulse.co",
|
|
||||||
"segheights.moneropulse.se"
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint64_t current_height = get_blockchain_current_height();
|
|
||||||
uint64_t best_diff = std::numeric_limits<uint64_t>::max(), best_height = 0;
|
|
||||||
std::vector<std::string> records;
|
|
||||||
if (tools::dns_utils::load_txt_records_from_dns(records, dns_urls))
|
|
||||||
{
|
|
||||||
for (const auto& record : records)
|
|
||||||
{
|
|
||||||
std::vector<std::string> fields;
|
|
||||||
boost::split(fields, record, boost::is_any_of(":"));
|
|
||||||
if (fields.size() != 2)
|
|
||||||
continue;
|
|
||||||
uint64_t height;
|
|
||||||
if (!string_tools::get_xtype_from_string(height, fields[1]))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
MINFO("Found segregation height via DNS: " << fields[0] << " fork height at " << height);
|
|
||||||
uint64_t diff = height > current_height ? height - current_height : current_height - height;
|
|
||||||
if (diff < best_diff)
|
|
||||||
{
|
|
||||||
best_diff = diff;
|
|
||||||
best_height = height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (best_height)
|
|
||||||
return best_height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return SEGREGATION_FORK_HEIGHT;
|
return SEGREGATION_FORK_HEIGHT;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue