Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 1,269 Lines • ▼ Show 20 Lines | uint64_t extra_entropy = | ||||
.Write(id) | .Write(id) | ||||
.Finalize(); | .Finalize(); | ||||
CAddress addr_bind = GetBindAddress(hSocket); | CAddress addr_bind = GetBindAddress(hSocket); | ||||
ServiceFlags nodeServices = nLocalServices; | ServiceFlags nodeServices = nLocalServices; | ||||
if (NetPermissions::HasFlag(permissionFlags, PF_BLOOMFILTER)) { | if (NetPermissions::HasFlag(permissionFlags, PF_BLOOMFILTER)) { | ||||
nodeServices = static_cast<ServiceFlags>(nodeServices | NODE_BLOOM); | nodeServices = static_cast<ServiceFlags>(nodeServices | NODE_BLOOM); | ||||
} | } | ||||
CNode *pnode = new CNode(id, nodeServices, GetBestHeight(), hSocket, addr, | |||||
CalculateKeyedNetGroup(addr), nonce, extra_entropy, | const bool inbound_onion = | ||||
addr_bind, "", ConnectionType::INBOUND); | std::find(m_onion_binds.begin(), m_onion_binds.end(), addr_bind) != | ||||
m_onion_binds.end(); | |||||
CNode *pnode = | |||||
new CNode(id, nodeServices, GetBestHeight(), hSocket, addr, | |||||
CalculateKeyedNetGroup(addr), nonce, extra_entropy, addr_bind, | |||||
"", ConnectionType::INBOUND, inbound_onion); | |||||
pnode->AddRef(); | pnode->AddRef(); | ||||
pnode->m_permissionFlags = permissionFlags; | pnode->m_permissionFlags = permissionFlags; | ||||
// If this flag is present, the user probably expect that RPC and QT report | // If this flag is present, the user probably expect that RPC and QT report | ||||
// it as whitelisted (backward compatibility) | // it as whitelisted (backward compatibility) | ||||
pnode->m_legacyWhitelisted = legacyWhitelisted; | pnode->m_legacyWhitelisted = legacyWhitelisted; | ||||
pnode->m_prefer_evict = discouraged; | pnode->m_prefer_evict = discouraged; | ||||
m_msgproc->InitializeNode(*config, pnode); | m_msgproc->InitializeNode(*config, pnode); | ||||
▲ Show 20 Lines • Show All 1,910 Lines • ▼ Show 20 Lines | double CNode::AvalancheState::getAvailabilityScore() const { | ||||
// when reading. | // when reading. | ||||
return availabilityScore; | return availabilityScore; | ||||
} | } | ||||
CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, | CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, | ||||
int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, | int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, | ||||
uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, | uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, | ||||
uint64_t nLocalExtraEntropyIn, const CAddress &addrBindIn, | uint64_t nLocalExtraEntropyIn, const CAddress &addrBindIn, | ||||
const std::string &addrNameIn, ConnectionType conn_type_in) | const std::string &addrNameIn, ConnectionType conn_type_in, | ||||
bool inbound_onion) | |||||
: nTimeConnected(GetSystemTimeInSeconds()), addr(addrIn), | : nTimeConnected(GetSystemTimeInSeconds()), addr(addrIn), | ||||
addrBind(addrBindIn), nKeyedNetGroup(nKeyedNetGroupIn), | addrBind(addrBindIn), 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). | ||||
id(idIn), nLocalHostNonce(nLocalHostNonceIn), | id(idIn), nLocalHostNonce(nLocalHostNonceIn), | ||||
nLocalExtraEntropy(nLocalExtraEntropyIn), m_conn_type(conn_type_in), | nLocalExtraEntropy(nLocalExtraEntropyIn), m_conn_type(conn_type_in), | ||||
nLocalServices(nLocalServicesIn), nMyStartingHeight(nMyStartingHeightIn) { | nLocalServices(nLocalServicesIn), nMyStartingHeight(nMyStartingHeightIn), | ||||
m_inbound_onion(inbound_onion) { | |||||
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>(); | ||||
} | } | ||||
if (RelayAddrsWithConn()) { | if (RelayAddrsWithConn()) { | ||||
▲ Show 20 Lines • Show All 162 Lines • Show Last 20 Lines |