From acab673a6ed7cb8b04887e215e4fbab115ff9b33 Mon Sep 17 00:00:00 2001 From: jw Date: Wed, 22 Apr 2020 17:03:37 -0700 Subject: [PATCH] Revert "allow sync over tor" --- src/cryptonote_protocol/cryptonote_protocol_handler.inl | 6 ++---- src/p2p/net_node.cpp | 3 +-- src/p2p/net_node.inl | 5 ++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index be6d920e1..9d02efe62 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -345,9 +345,7 @@ namespace cryptonote } // No chain synchronization over hidden networks (tor, i2p, etc.) - // if(context.m_remote_address.get_zone() != epee::net_utils::zone::public_) - // wow wow wow ... - if (false) + if(context.m_remote_address.get_zone() != epee::net_utils::zone::public_) { context.m_state = cryptonote_connection_context::state_normal; return true; @@ -2386,7 +2384,7 @@ skip: std::vector> fullConnections, fluffyConnections; m_p2p->for_each_connection([this, &exclude_context, &fullConnections, &fluffyConnections](connection_context& context, nodetool::peerid_type peer_id, uint32_t support_flags) { - if (peer_id && exclude_context.m_connection_id != context.m_connection_id) + if (peer_id && exclude_context.m_connection_id != context.m_connection_id && context.m_remote_address.get_zone() == epee::net_utils::zone::public_) { if(m_core.fluffy_blocks_enabled() && (support_flags & P2P_SUPPORT_FLAG_FLUFFY_BLOCKS)) { diff --git a/src/p2p/net_node.cpp b/src/p2p/net_node.cpp index e4968f603..58c5706de 100644 --- a/src/p2p/net_node.cpp +++ b/src/p2p/net_node.cpp @@ -313,8 +313,7 @@ namespace nodetool break; } - // nice try - // if (address.get_zone() == epee::net_utils::zone::public_) + if (address.get_zone() == epee::net_utils::zone::public_) return false; MWARNING("Filtered command (#" << command << ") to/from " << address.str()); diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 7dd906988..65ccb411d 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -135,7 +135,6 @@ namespace nodetool m_peerlist_storage = std::move(*storage); m_network_zones[epee::net_utils::zone::public_].m_config.m_support_flags = P2P_SUPPORT_FLAGS; - m_network_zones[epee::net_utils::zone::tor].m_config.m_support_flags = P2P_SUPPORT_FLAGS; m_first_connection_maker_call = true; CATCH_ENTRY_L0("node_server::init_config", false); @@ -2161,8 +2160,8 @@ namespace nodetool template bool node_server::try_get_support_flags(const p2p_connection_context& context, std::function f) { - // if(context.m_remote_address.get_zone() != epee::net_utils::zone::public_) - // return false; + if(context.m_remote_address.get_zone() != epee::net_utils::zone::public_) + return false; COMMAND_REQUEST_SUPPORT_FLAGS::request support_flags_request; bool r = epee::net_utils::async_invoke_remote_command2