|
|
@ -190,6 +190,16 @@ bool GetLocal(CService& addr, const CNode& peer) |
|
|
|
LOCK(cs_mapLocalHost); |
|
|
|
for (map<CNetAddr, LocalServiceInfo>::iterator it = mapLocalHost.begin(); it != mapLocalHost.end(); it++) |
|
|
|
{ |
|
|
|
// For privacy reasons, don't advertise our privacy-network address
|
|
|
|
// to other networks and don't advertise our other-network address
|
|
|
|
// to privacy networks.
|
|
|
|
const Network our_net{(*it).first.GetNetwork()}; |
|
|
|
const Network peers_net{peer.ConnectedThroughNetwork()}; |
|
|
|
if (our_net != peers_net && |
|
|
|
(our_net == NET_ONION || our_net == NET_I2P || |
|
|
|
peers_net == NET_ONION || peers_net == NET_I2P)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
int nScore = (*it).second.nScore; |
|
|
|
int nReachability = (*it).first.GetReachabilityFrom(peer.addr); |
|
|
|
if (nReachability > nBestReachability || (nReachability == nBestReachability && nScore > nBestScore)) |
|
|
@ -575,6 +585,11 @@ extern int32_t HUSH_NSPV; |
|
|
|
#define HUSH_NSPV_SUPERLITE (HUSH_NSPV > 0) |
|
|
|
#endif // !HUSH_NSPV_SUPERLITE
|
|
|
|
|
|
|
|
Network CNode::ConnectedThroughNetwork() const |
|
|
|
{ |
|
|
|
return m_inbound_onion ? NET_ONION : addr.GetNetClass(); |
|
|
|
} |
|
|
|
|
|
|
|
void CNode::PushVersion() |
|
|
|
{ |
|
|
|
int nBestHeight = g_signals.GetHeight().get_value_or(0); |
|
|
@ -1266,6 +1281,7 @@ void CreateNodeFromAcceptedSocket(SOCKET hSocket, |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// Don't accept connections from banned peers.
|
|
|
|
if (CNode::IsBanned(addr) && !allowlisted) |
|
|
|
{ |
|
|
|
LogPrintf("connection from %s dropped (banned)\n", addr.ToString()); |
|
|
@ -1320,6 +1336,8 @@ void CreateNodeFromAcceptedSocket(SOCKET hSocket, |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const bool inbound_onion = std::find(m_onion_binds.begin(), m_onion_binds.end(), addr_bind) != m_onion_binds.end(); |
|
|
|
|
|
|
|
CNode* pnode = new CNode(hSocket, addr, "", true, ssl); |
|
|
|
pnode->AddRef(); |
|
|
|
pnode->fAllowlisted = allowlisted; |
|
|
|