Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 2,990 Lines • ▼ Show 20 Lines | CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, | ||||
: nTimeConnected(GetSystemTimeInSeconds()), addr(addrIn), | : nTimeConnected(GetSystemTimeInSeconds()), addr(addrIn), | ||||
addrBind(addrBindIn), fFeeler(conn_type_in == ConnectionType::FEELER), | addrBind(addrBindIn), fFeeler(conn_type_in == ConnectionType::FEELER), | ||||
m_manual_connection(conn_type_in == ConnectionType::MANUAL), | m_manual_connection(conn_type_in == ConnectionType::MANUAL), | ||||
fInbound(conn_type_in == ConnectionType::INBOUND), | fInbound(conn_type_in == ConnectionType::INBOUND), | ||||
nKeyedNetGroup(nKeyedNetGroupIn), | nKeyedNetGroup(nKeyedNetGroupIn), | ||||
// Don't relay addr messages to peers that we connect to as | // Don't relay addr messages to peers that we connect to as | ||||
// block-relay-only peers (to prevent adversaries from inferring these | // block-relay-only peers (to prevent adversaries from inferring these | ||||
// links from addr traffic). | // links from addr traffic). | ||||
m_addr_known{conn_type_in == ConnectionType::BLOCK_RELAY | |||||
? nullptr | |||||
: std::make_unique<CRollingBloomFilter>(5000, 0.001)}, | |||||
id(idIn), nLocalHostNonce(nLocalHostNonceIn), | id(idIn), nLocalHostNonce(nLocalHostNonceIn), | ||||
nLocalServices(nLocalServicesIn), nMyStartingHeight(nMyStartingHeightIn) { | nLocalServices(nLocalServicesIn), nMyStartingHeight(nMyStartingHeightIn) { | ||||
hSocket = hSocketIn; | hSocket = hSocketIn; | ||||
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; | addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; | ||||
hashContinue = BlockHash(); | hashContinue = BlockHash(); | ||||
if (conn_type_in != ConnectionType::BLOCK_RELAY) { | if (conn_type_in != ConnectionType::BLOCK_RELAY) { | ||||
m_tx_relay = std::make_unique<TxRelay>(); | m_tx_relay = std::make_unique<TxRelay>(); | ||||
m_addr_known = std::make_unique<CRollingBloomFilter>(5000, 0.001); | |||||
} | } | ||||
for (const std::string &msg : getAllNetMessageTypes()) { | for (const std::string &msg : getAllNetMessageTypes()) { | ||||
mapRecvBytesPerMsgCmd[msg] = 0; | mapRecvBytesPerMsgCmd[msg] = 0; | ||||
} | } | ||||
mapRecvBytesPerMsgCmd[NET_MESSAGE_COMMAND_OTHER] = 0; | mapRecvBytesPerMsgCmd[NET_MESSAGE_COMMAND_OTHER] = 0; | ||||
if (fLogIPs) { | if (fLogIPs) { | ||||
▲ Show 20 Lines • Show All 147 Lines • Show Last 20 Lines |