Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2019 The Bitcoin Core developers | // Copyright (c) 2009-2019 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#if defined(HAVE_CONFIG_H) | #if defined(HAVE_CONFIG_H) | ||||
#include <config/bitcoin-config.h> | #include <config/bitcoin-config.h> | ||||
#endif | #endif | ||||
#include <net.h> | #include <net.h> | ||||
#include <avalanche/avalanche.h> | |||||
#include <banman.h> | #include <banman.h> | ||||
#include <clientversion.h> | #include <clientversion.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <consensus/consensus.h> | #include <consensus/consensus.h> | ||||
#include <crypto/sha256.h> | #include <crypto/sha256.h> | ||||
#include <dnsseeds.h> | #include <dnsseeds.h> | ||||
#include <netbase.h> | #include <netbase.h> | ||||
#include <node/ui_interface.h> | #include <node/ui_interface.h> | ||||
▲ Show 20 Lines • Show All 2,982 Lines • ▼ Show 20 Lines | CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, | ||||
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); | m_addr_known = std::make_unique<CRollingBloomFilter>(5000, 0.001); | ||||
} | } | ||||
// Don't relay proofs if avalanche is disabled | |||||
if (isAvalancheEnabled(gArgs)) { | |||||
m_proof_relay = std::make_unique<ProofRelay>(); | |||||
} | |||||
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) { | ||||
LogPrint(BCLog::NET, "Added connection to %s peer=%d\n", addrName, id); | LogPrint(BCLog::NET, "Added connection to %s peer=%d\n", addrName, id); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 145 Lines • Show Last 20 Lines |