Skip to content

Commit 6609eb8

Browse files
committed
net: assert CNode::m_inbound_onion is inbound in ctor
and drop an unneeded check in CNode::ConnectedThroughNetwork()
1 parent 993d1ec commit 6609eb8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/net.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ void CNode::SetAddrLocal(const CService& addrLocalIn) {
555555

556556
Network CNode::ConnectedThroughNetwork() const
557557
{
558-
return IsInboundConn() && m_inbound_onion ? NET_ONION : addr.GetNetClass();
558+
return m_inbound_onion ? NET_ONION : addr.GetNetClass();
559559
}
560560

561561
#undef X
@@ -2954,6 +2954,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
29542954
nMyStartingHeight(nMyStartingHeightIn),
29552955
m_inbound_onion(inbound_onion)
29562956
{
2957+
if (inbound_onion) assert(conn_type_in == ConnectionType::INBOUND);
29572958
hSocket = hSocketIn;
29582959
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn;
29592960
hashContinue = uint256();

src/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ class CNode
11101110
CService addrLocal GUARDED_BY(cs_addrLocal);
11111111
mutable RecursiveMutex cs_addrLocal;
11121112

1113-
//! Whether this peer connected via our Tor onion service.
1113+
//! Whether this peer is an inbound onion, e.g. connected via our Tor onion service.
11141114
const bool m_inbound_onion{false};
11151115

11161116
public:

0 commit comments

Comments
 (0)