diff --git a/src/net.cpp b/src/net.cpp index b3c521116b5..cf1ac357128 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -555,7 +555,7 @@ void CNode::SetAddrLocal(const CService& addrLocalIn) { Network CNode::ConnectedThroughNetwork() const { - return IsInboundConn() && m_inbound_onion ? NET_ONION : addr.GetNetClass(); + return m_inbound_onion ? NET_ONION : addr.GetNetClass(); } #undef X @@ -2954,6 +2954,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn nMyStartingHeight(nMyStartingHeightIn), m_inbound_onion(inbound_onion) { + if (inbound_onion) assert(conn_type_in == ConnectionType::INBOUND); hSocket = hSocketIn; addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; hashContinue = uint256(); diff --git a/src/net.h b/src/net.h index b7c45abb094..ca5944d46b2 100644 --- a/src/net.h +++ b/src/net.h @@ -1110,7 +1110,7 @@ private: CService addrLocal GUARDED_BY(cs_addrLocal); mutable RecursiveMutex cs_addrLocal; - //! Whether this peer connected via our Tor onion service. + //! Whether this peer is an inbound onion, e.g. connected via our Tor onion service. const bool m_inbound_onion{false}; public: