Add a check for duplicate storage server broadcasts

Some users have gotten deregistered because of a cloned configuration
that had multiple nodes broadcasting the same SS IP/port.  This adds a
check and loud warning when sending out a proof if some other SN is
broadcasting the same SS info.
This commit is contained in:
Jason Rhinelander 2020-10-19 11:33:13 -03:00
parent 135bf75029
commit b4a4841326
1 changed files with 17 additions and 0 deletions

View File

@ -2220,6 +2220,23 @@ namespace cryptonote
return;
}
{
std::vector<crypto::public_key> sn_pks;
auto sns = m_service_node_list.get_service_node_list_state();
sn_pks.reserve(sns.size());
for (const auto& sni : sns)
sn_pks.push_back(sni.pubkey);
m_service_node_list.for_each_service_node_info_and_proof(sn_pks.begin(), sn_pks.end(), [&](auto& pk, auto& sni, auto& proof) {
if (pk != m_service_keys.pub && proof.public_ip == m_sn_public_ip &&
(proof.storage_port == m_storage_port || proof.storage_port == m_storage_lmq_port))
MGINFO_RED(
"Another service node (" << pk << ") is broadcasting the same storage server "
"IP and port as this service node. This will lead to deregistration of one or both service nodes. "
"(This most likely means that service-node-public-ip and/or storage-server-port settings are wrong.)");
});
}
if (m_nettype != DEVNET)
{
if (!check_external_ping(m_last_storage_server_ping, STORAGE_SERVER_PING_LIFETIME, "the storage server"))