Skip to content

Commit

Permalink
net: assert CNode::m_inbound_onion is inbound in ctor
Browse files Browse the repository at this point in the history
and drop an unneeded check in CNode::ConnectedThroughNetwork()
  • Loading branch information
jonatack committed Dec 17, 2020
1 parent 993d1ec commit 6609eb8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ class CNode
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:
Expand Down

0 comments on commit 6609eb8

Please sign in to comment.