net: assert CNode::m_inbound_onion is inbound in ctor

and drop an unneeded check in CNode::ConnectedThroughNetwork()
This commit is contained in:
Jon Atack
2020-10-21 11:52:19 +02:00
parent 993d1ecd19
commit 6609eb8cb5
2 changed files with 3 additions and 2 deletions

View File

@@ -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();