Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

net_processing.cpp File Reference
#include <net_processing.h>
#include <addrman.h>
#include <arith_uint256.h>
#include <blockencodings.h>
#include <chainparams.h>
#include <consensus/validation.h>
#include <hash.h>
#include <init.h>
#include <validation.h>
#include <merkleblock.h>
#include <netmessagemaker.h>
#include <netbase.h>
#include <policy/fees.h>
#include <policy/policy.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <random.h>
#include <reverse_iterator.h>
#include <scheduler.h>
#include <tinyformat.h>
#include <txdb.h>
#include <txmempool.h>
#include <ui_interface.h>
#include <util.h>
#include <utilmoneystr.h>
#include <utilstrencodings.h>
#include <memory>
#include <spork.h>
#include <governance/governance.h>
#include <masternode/masternode-payments.h>
#include <masternode/masternode-sync.h>
#include <masternode/masternode-meta.h>
#include <privatesend/privatesend-server.h>
#include <evo/deterministicmns.h>
#include <evo/mnauth.h>
#include <evo/simplifiedmns.h>
#include <llmq/quorums_blockprocessor.h>
#include <llmq/quorums_commitment.h>
#include <llmq/quorums_chainlocks.h>
#include <llmq/quorums_dkgsessionmgr.h>
#include <llmq/quorums_init.h>
#include <llmq/quorums_instantsend.h>
#include <llmq/quorums_signing.h>
#include <llmq/quorums_signing_shares.h>
+ Include dependency graph for net_processing.cpp:

Go to the source code of this file.

Classes

struct  IteratorComparator
 
struct  COrphanTx
 
class  CompareInvMempoolOrder
 
class  CNetProcessingCleanup
 

Functions

std::atomic< int64_t > nTimeBestReceived (0)
 
std::map< uint256, COrphanTx > mapOrphanTransactions GUARDED_BY (g_cs_orphans)
 
void EraseOrphansFor (NodeId peer)
 
void EraseObjectRequest (CNodeState *nodestate, const CInv &inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 
void EraseObjectRequest (NodeId nodeId, const CInv &inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 
std::chrono::microseconds GetObjectRequestTime (const uint256 &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 
void UpdateObjectRequestTime (const uint256 &hash, std::chrono::microseconds request_time) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 
std::chrono::microseconds GetObjectInterval (int invType)
 
std::chrono::microseconds GetObjectExpiryInterval (int invType)
 
std::chrono::microseconds GetObjectRandomDelay (int invType)
 
std::chrono::microseconds CalculateObjectGetDataTime (const CInv &inv, std::chrono::microseconds current_time, bool use_inbound_delay) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 
void RequestObject (CNodeState *state, const CInv &inv, std::chrono::microseconds current_time, bool fForce=false) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 
void RequestObject (NodeId nodeId, const CInv &inv, std::chrono::microseconds current_time, bool fForce) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 
size_t GetRequestedObjectCount (NodeId nodeId)
 
void UpdateLastBlockAnnounceTime (NodeId node, int64_t time_in_seconds)
 
bool IsOutboundDisconnectionCandidate (const CNode *node)
 
bool GetNodeStateStats (NodeId nodeid, CNodeStateStats &stats)
 Get statistics from node state. More...
 
void AddToCompactExtraTransactions (const CTransactionRef &tx) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans)
 
bool AddOrphanTx (const CTransactionRef &tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans)
 
static int EraseOrphanTx (uint256 hash) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans)
 
unsigned int LimitOrphanTxSize (unsigned int nMaxOrphansSize)
 
static void ProcessOrphanTx (CConnman *connman, std::set< uint256 > &orphan_work_set) EXCLUSIVE_LOCKS_REQUIRED(cs_main
 
void Misbehaving (NodeId pnode, int howmuch, const std::string &message)
 Increase a node's misbehavior score. More...
 
bool IsBanned (NodeId pnode)
 
static bool BlockRequestAllowed (const CBlockIndex *pindex, const Consensus::Params &consensusParams)
 
static bool AlreadyHave (const CInv &inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
 
static void RelayAddress (const CAddress &addr, bool fReachable, CConnman *connman)
 
static void ProcessGetBlockData (CNode *pfrom, const CChainParams &chainparams, const CInv &inv, CConnman *connman, const std::atomic< bool > &interruptMsgProc)
 
static void ProcessGetData (CNode *pfrom, const CChainParams &chainparams, CConnman *connman, const std::atomic< bool > &interruptMsgProc)
 
static void SendBlockTransactions (const CBlock &block, const BlockTransactionsRequest &req, CNode *pfrom, CConnman *connman)
 
static bool ProcessHeadersMessage (CNode *pfrom, CConnman *connman, const std::vector< CBlockHeader > &headers, const CChainParams &chainparams, bool punish_duplicate_invalid)
 
 AssertLockHeld (g_cs_orphans)
 
 while (!done &&!orphan_work_set.empty())
 
static bool ProcessMessage (CNode *pfrom, const std::string &strCommand, CDataStream &vRecv, int64_t nTimeReceived, const CChainParams &chainparams, CConnman *connman, const std::atomic< bool > &interruptMsgProc)
 
static bool SendRejectsAndCheckIfBanned (CNode *pnode, CConnman *connman)
 

Variables

static constexpr int32_t MAX_PEER_OBJECT_IN_FLIGHT = 100
 Maximum number of in-flight objects from a peer. More...
 
static constexpr int32_t MAX_PEER_OBJECT_ANNOUNCEMENTS = 2 * MAX_INV_SZ
 Maximum number of announced objects from a peer. More...
 
static constexpr std::chrono::microseconds INBOUND_PEER_TX_DELAY {std::chrono::seconds{2}}
 How many microseconds to delay requesting transactions from inbound peers. More...
 
static constexpr std::chrono::microseconds GETDATA_TX_INTERVAL {std::chrono::seconds{60}}
 How long to wait (in microseconds) before downloading a transaction from an additional peer. More...
 
static constexpr std::chrono::microseconds MAX_GETDATA_RANDOM_DELAY {std::chrono::seconds{2}}
 Maximum delay (in microseconds) for transaction requests to avoid biasing some peers over others. More...
 
static constexpr int64_t TX_EXPIRY_INTERVAL_FACTOR = 10
 How long to wait (expiry * factor microseconds) before expiring an in-flight getdata request to a peer. More...
 
static const unsigned int MAX_GETDATA_SZ = 1000
 Limit to avoid sending big packets. More...
 
bool g_enable_bip61 = DEFAULT_ENABLE_BIP61
 Enable BIP61 (sending reject messages) More...
 
static CCriticalSection g_cs_orphans
 
size_t nMapOrphanTransactionsSize = 0
 
static const uint64_t RANDOMIZER_ID_ADDRESS_RELAY = 0x3cac0035b5866b90ULL
 
static const int STALE_RELAY_AGE_LIMIT = 30 * 24 * 60 * 60
 Age after which a stale block will no longer be served if requested as protection against fingerprinting. More...
 
static const int HISTORICAL_BLOCK_AGE = 7 * 24 * 60 * 60
 Age after which a block is considered historical for purposes of rate limiting block relay. More...
 
static constexpr unsigned int AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL = 24 * 60 * 60
 Average delay between local address broadcasts in seconds. More...
 
static const unsigned int AVG_ADDRESS_BROADCAST_INTERVAL = 30
 Average delay between peer address broadcasts in seconds. More...
 
static const unsigned int INVENTORY_BROADCAST_INTERVAL = 5
 Average delay between trickled inventory transmissions in seconds. More...
 
static constexpr unsigned int INVENTORY_BROADCAST_MAX_PER_1MB_BLOCK = 4 * 7 * INVENTORY_BROADCAST_INTERVAL
 Maximum number of inventory items to send per transmission. More...
 
static CCriticalSection cs_most_recent_block
 
static std::shared_ptr< const CBlockmost_recent_block
 
static std::shared_ptr< const CBlockHeaderAndShortTxIDsmost_recent_compact_block
 
static uint256 most_recent_block_hash
 
std::set< NodeIdsetMisbehaving
 
bool done = false
 
class CNetProcessingCleanup instance_of_cnetprocessingcleanup
 

Function Documentation

◆ AddOrphanTx()

◆ AddToCompactExtraTransactions()

void AddToCompactExtraTransactions ( const CTransactionRef tx)

◆ AlreadyHave()

◆ AssertLockHeld()

AssertLockHeld ( g_cs_orphans  )

Referenced by CChainState::AcceptBlock(), CChainState::AcceptBlockHeader(), AcceptToMemoryPoolWorker(), CChainState::ActivateBestChainStep(), CWallet::AddHDPubKey(), CWallet::AddKeyPubKeyWithDB(), CGovernanceTriggerManager::AddNewTrigger(), llmq::CInstantSendManager::AddNonLockedTx(), CWallet::AddToWalletIfInvolvingMe(), blockheaderToJSON(), BlockRequestAllowed(), blockToJSON(), CDeterministicMNManager::BuildNewListFromBlock(), BuildSimplifiedMNListDiff(), CalculateObjectGetDataTime(), CWallet::CanSupportFeature(), CheckFinalTx(), CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), CheckInputs(), CheckInputsFromMempoolAndCache(), CheckSequenceLocks(), CGovernanceTriggerManager::CleanAndRemove(), CDeterministicMNManager::CleanupCache(), CNode::CloseSocketDisconnect(), llmq::CSigSharesManager::CollectSigSharesToAnnounce(), llmq::CSigSharesManager::CollectSigSharesToRequest(), llmq::CSigSharesManager::CollectSigSharesToSend(), llmq::CSigSharesManager::CollectSigSharesToSendConcentrated(), CChainState::ConnectBlock(), PeerLogicValidation::ConsiderEviction(), CPrivateSendClientSession::CreateDenominated(), entryToJSON(), EraseObjectRequest(), TransactionDesc::FormatTxStatus(), CWallet::GenerateNewKey(), CGovernanceTriggerManager::GetActiveTriggers(), CWallet::GetAddressGroupings(), CSuperblockManager::GetBestSuperblock(), GetBlockScriptFlags(), llmq::CQuorumBlockProcessor::GetCommitmentsFromBlock(), CWallet::GetConflicts(), CEvoDB::GetCurTransaction(), CMerkleTx::GetDepthInMainChain(), CSuperblock::GetGovernanceObject(), CWallet::GetKeyBirthTimes(), CWallet::GetKeyPoolSize(), llmq::CQuorumBlockProcessor::GetMinableCommitment(), llmq::CQuorumBlockProcessor::GetMinableCommitmentTx(), GetObjectRequestTime(), llmq::CQuorumBlockProcessor::GetQuorumBlockHash(), GetRequestedObjectCount(), CTxMemPool::GetSortedDepthAndScore(), CWallet::GetSpendableTXs(), CWallet::IncOrderPosNext(), llmq::CChainLocksHandler::InternalHasChainLock(), llmq::CChainLocksHandler::InternalHasConflictingChainLock(), CChainState::InvalidateBlock(), CMerkleTx::IsChainLocked(), CGovernanceObject::IsCollateralValid(), IsCurrentForFeeEstimation(), CWallet::IsLockedCoin(), CWallet::KeypoolCountExternalKeys(), CWallet::KeypoolCountInternalKeys(), CWallet::ListLockedCoins(), CWallet::ListProTxCoins(), CWallet::LoadHDPubKey(), CWallet::LoadKeyMetadata(), CWallet::LoadKeyPool(), CWallet::LoadMinVersion(), CWallet::LoadScriptMetadata(), CWallet::LockCoin(), CPrivateSendClientSession::MakeCollateralAmounts(), CWallet::MarkReserveKeysAsUsed(), ParseBlock(), CPrivateSendClientSession::PrepareDenominate(), llmq::CQuorumBlockProcessor::ProcessBlock(), CDeterministicMNManager::ProcessBlock(), llmq::CInstantSendManager::RemoveConflictedTx(), llmq::CInstantSendManager::RemoveNonLockedTx(), llmq::CRecoveredSigsDb::RemoveRecoveredSig(), CTxMemPool::RemoveStaged(), CWallet::RemoveWatchOnly(), RequestObject(), CChainState::ResetBlockFailureFlags(), CGovernanceManager::ScopedLockBool::ScopedLockBool(), SendRejectsAndCheckIfBanned(), TransactionRecord::statusUpdateNeeded(), TestBlockValidity(), TestLockPointValidity(), CTxMemPool::trackPackageRemoved(), llmq::CQuorumBlockProcessor::UndoBlock(), CWallet::UnlockAllCoins(), CWallet::UnlockCoin(), CPrivateSend::UpdateDSTXConfirmedHeight(), UpdateMempoolForReorg(), UpdateObjectRequestTime(), TransactionRecord::updateStatus(), CWallet::UpdateTimeFirstKey(), VersionBitsTipState(), WalletTxToJSON(), and CWallet::ZapSelectTx().

◆ BlockRequestAllowed()

◆ CalculateObjectGetDataTime()

std::chrono::microseconds CalculateObjectGetDataTime ( const CInv inv,
std::chrono::microseconds  current_time,
bool  use_inbound_delay 
)

◆ EraseObjectRequest() [1/2]

◆ EraseObjectRequest() [2/2]

void EraseObjectRequest ( NodeId  nodeId,
const CInv inv 
)

Definition at line 689 of file net_processing.cpp.

References AssertLockHeld(), cs_main, and EraseObjectRequest().

◆ EraseOrphansFor()

void EraseOrphansFor ( NodeId  peer)

◆ EraseOrphanTx()

static int EraseOrphanTx ( uint256  hash)
static

◆ GetNodeStateStats()

bool GetNodeStateStats ( NodeId  nodeid,
CNodeStateStats stats 
)

◆ GetObjectExpiryInterval()

std::chrono::microseconds GetObjectExpiryInterval ( int  invType)

◆ GetObjectInterval()

std::chrono::microseconds GetObjectInterval ( int  invType)

◆ GetObjectRandomDelay()

std::chrono::microseconds GetObjectRandomDelay ( int  invType)

Definition at line 741 of file net_processing.cpp.

References GetRandMicros(), MAX_GETDATA_RANDOM_DELAY, and MSG_TX.

Referenced by CalculateObjectGetDataTime().

◆ GetObjectRequestTime()

std::chrono::microseconds GetObjectRequestTime ( const uint256 hash)

Definition at line 699 of file net_processing.cpp.

References AssertLockHeld(), and cs_main.

Referenced by CalculateObjectGetDataTime(), and PeerLogicValidation::SendMessages().

◆ GetRequestedObjectCount()

size_t GetRequestedObjectCount ( NodeId  nodeId)

Definition at line 807 of file net_processing.cpp.

References AssertLockHeld(), and cs_main.

Referenced by CGovernanceManager::RequestGovernanceObjectVotes().

◆ GUARDED_BY()

static std::vector< std::pair< uint256, CTransactionRef > > vExtraTxnForCompact GUARDED_BY ( g_cs_orphans  )

◆ IsBanned()

bool IsBanned ( NodeId  pnode)

◆ IsOutboundDisconnectionCandidate()

◆ LimitOrphanTxSize()

unsigned int LimitOrphanTxSize ( unsigned int  nMaxOrphansSize)

◆ Misbehaving()

◆ nTimeBestReceived()

std::atomic<int64_t> nTimeBestReceived ( )

◆ ProcessGetBlockData()

◆ ProcessGetData()

static void ProcessGetData ( CNode pfrom,
const CChainParams chainparams,
CConnman connman,
const std::atomic< bool > &  interruptMsgProc 
)
static

◆ ProcessHeadersMessage()

◆ ProcessMessage()

static bool ProcessMessage ( CNode pfrom,
const std::string &  strCommand,
CDataStream vRecv,
int64_t  nTimeReceived,
const CChainParams chainparams,
CConnman connman,
const std::atomic< bool > &  interruptMsgProc 
)
static

Definition at line 2002 of file net_processing.cpp.

References AcceptToMemoryPool(), ActivateBestChain(), CNode::AddAddressKnown(), CPrivateSend::AddDSTX(), CNode::AddInventoryKnown(), CConnman::AddNewAddresses(), AddOrphanTx(), NetMsgType::ADDR, CNode::addr, AddTimeData(), AddToCompactExtraTransactions(), AlreadyHave(), BIP0031_VERSION, NetMsgType::BLOCK, BLOCK_HAVE_DATA, BLOCK_VALID_TRANSACTIONS, BlockTransactionsRequest::blockhash, BlockTransactions::blockhash, BlockRequestAllowed(), NetMsgType::BLOCKTXN, BuildSimplifiedMNListDiff(), CADDR_TIME_VERSION, chainActive, llmq::chainLocksHandler, CTxMemPool::check(), CConnman::CheckIncomingNonce(), CPrivateSendBroadcastTx::CheckSignature(), NetMsgType::CMPCTBLOCK, COIN, CMessageHeader::COMMAND_SIZE, CValidationState::CorruptionPossible(), CNode::cs_filter, CNode::cs_inventory, cs_main, CNode::cs_mnauth, cs_most_recent_block, CNode::cs_SubVer, DEFAULT_MAX_ORPHAN_TRANSACTIONS_SIZE, llmq::DEFAULT_WATCH_QUORUMS, DEFAULT_WHITELISTFORCERELAY, DEFAULT_WHITELISTRELAY, deterministicMNManager, CBaseChainParams::DEVNET, CMasternodeMetaMan::DisallowMixing(), NetMsgType::DSTX, CTxMemPool::DynamicMemoryUsage(), CDataStream::empty(), EraseObjectRequest(), CNode::fClient, CNode::fDisconnect, CNode::fFeeler, CNode::fFirstMessageIsMNAUTH, CNode::fGetAddr, PartiallyDownloadedBlock::FillBlock(), NetMsgType::FILTERADD, NetMsgType::FILTERCLEAR, NetMsgType::FILTERLOAD, fImporting, CNode::fInbound, FindForkInGlobalIndex(), fListen, fLogIPs, CNode::fMasternode, fMasternodeMode, CNode::fMasternodeProbe, CNode::fOneShot, FormatStateMessage(), fPruneMode, fReindex, fRelayTxes, CNode::fRelayTxes, CNode::fSendDSQueue, CNode::fSendMempool, CNode::fSendRecSigs, CNode::fSentAddr, CNode::fSuccessfullyConnected, CNode::fWhitelisted, g_cs_orphans, g_enable_bip61, gArgs, NetMsgType::GETADDR, CConnman::GetAddressCount(), CConnman::GetAddresses(), GetAdjustedTime(), getAllNetMessageTypes(), ArgsManager::GetArg(), CBlockIndex::GetBlockHash(), GetBlockHash(), NetMsgType::GETBLOCKS, CBlockIndex::GetBlockTime(), NetMsgType::GETBLOCKTXN, ArgsManager::GetBoolArg(), CChainParams::GetConsensus(), NetMsgType::GETDATA, GetDesirableServiceFlags(), ArgsManager::GetDevNetName(), CPrivateSend::GetDSTX(), CTransaction::GetHash(), NetMsgType::GETHEADERS, CNode::GetId(), GetLocalAddress(), CNode::GetLocalServices(), CChain::GetLocator(), CMasternodeMetaMan::GetMetaInfo(), NetMsgType::GETMNLISTDIFF, GetRand(), CValidationState::GetRejectCode(), CValidationState::GetRejectReason(), CNode::GetSendVersion(), GetTime(), GetTimeMicros(), governance, HasAllDesirableServiceFlags(), COutPoint::hash, CNode::hashContinue, NetMsgType::HEADERS, HEADERS_DOWNLOAD_TIMEOUT_BASE, HEADERS_DOWNLOAD_TIMEOUT_PER_HEADER, CChain::Height(), CDataStream::in_avail(), BlockTransactionsRequest::indexes, INIT_PROTO_VERSION, PartiallyDownloadedBlock::InitData(), NetMsgType::INV, ArgsManager::IsArgSet(), IsInitialBlockDownload(), CValidationState::IsInvalid(), CBlockLocator::IsNull(), IsPeerAddrLocalGood(), IsReachable(), CNetAddr::IsRoutable(), PartiallyDownloadedBlock::IsTxAvailable(), CBlockIndex::IsValid(), CPrivateSendBroadcastTx::IsValidStructure(), itostr(), NetMsgType::LEGACYTXLOCKREQUEST, LIMITED_STRING, LimitOrphanTxSize(), LLMQS_PROTO_VERSION, LOCK, LOCK2, LogAcceptCategory(), LogPrint, LogPrintf, CNode::m_limited_node, CNode::m_manual_connection, mapBlockIndex, CConnman::MarkAddressGood(), CPrivateSendBroadcastTx::masternodeOutpoint, masternodeSync, MAX_BLOCKS_IN_TRANSIT_PER_PEER, MAX_BLOCKTXN_DEPTH, MAX_HEADERS_RESULTS, MAX_INV_SZ, MAX_PEER_OBJECT_IN_FLIGHT, MAX_REJECT_MESSAGE_LENGTH, MAX_SCRIPT_ELEMENT_SIZE, MAX_SUBVERSION_LENGTH, MayHaveUsefulAddressDB(), NetMsgType::MEMPOOL, BCLog::MEMPOOL, mempool, BCLog::MEMPOOLREJ, MIN_BLOCKS_TO_KEEP, MIN_PEER_PROTO_VERSION, Misbehaving(), mmetaman, NetMsgType::MNAUTH, NetMsgType::MNLISTDIFF, most_recent_block, most_recent_block_hash, MSG_BLOCK, MSG_DSTX, MSG_SPORK, MSG_TX, CBlockIndex::nChainWork, BCLog::NET, BCLog::NET_NETCONN, CChain::Next(), CBlockIndex::nHeight, CNode::nLastBlockTime, CNode::nLastTXTime, nMaxTipAge, CNode::nMinPingUsecTime, NO_BLOOM_VERSION, NODE_BLOOM, NODE_NETWORK, NODE_NETWORK_LIMITED, NetMsgType::NOTFOUND, CNode::nPingNonceSent, CNode::nPingUsecStart, CNode::nPingUsecTime, Consensus::Params::nPowTargetSpacing, CAddress::nServices, CNode::nServices, CNode::nStartingHeight, CBlockIndex::nStatus, CAddress::nTime, CNode::nTimeFirstMessageReceived, nTimeOffset, CNode::nTimeOffset, CBlockIndex::nTx, CNode::nVersion, CNode::orphan_work_set, CConnman::OutboundTargetReached(), Params(), pcoinsTip, pindexBestHeader, NetMsgType::PING, NetMsgType::PONG, CTxIn::prevout, CTxMemPool::PrioritiseTransaction(), BCLog::PRIVATESEND, privateSendClient, privateSendServer, ProcessGetData(), ProcessHeadersMessage(), llmq::CQuorumBlockProcessor::ProcessMessage(), CMNAuth::ProcessMessage(), llmq::CDKGSessionManager::ProcessMessage(), CMasternodeSync::ProcessMessage(), CPrivateSendServer::ProcessMessage(), llmq::CChainLocksHandler::ProcessMessage(), llmq::CInstantSendManager::ProcessMessage(), llmq::CSigningManager::ProcessMessage(), CPrivateSendClientManager::ProcessMessage(), CGovernanceManager::ProcessMessage(), llmq::CSigSharesManager::ProcessMessage(), ProcessNewBlock(), ProcessNewBlockHeaders(), ProcessOrphanTx(), CSporkManager::ProcessSpork(), PROTOCOL_VERSION, CNode::PushAddress(), CNode::PushInventory(), CConnman::PushMessage(), CMNAuth::PushMNAUTH(), NetMsgType::QSENDRECSIGS, llmq::quorumBlockProcessor, llmq::quorumDKGSessionManager, llmq::quorumInstantSendManager, llmq::quorumSigningManager, llmq::quorumSigSharesManager, NetMsgType::QWATCH, READ_STATUS_FAILED, READ_STATUS_INVALID, READ_STATUS_OK, ReadBlockFromDisk(), ReadCompactSize(), CNode::receivedMNAuthChallenge, RecursiveDynamicUsage(), NetMsgType::REJECT, REJECT_DUPLICATE, REJECT_INTERNAL, REJECT_NONSTANDARD, REJECT_OBSOLETE, RelayAddress(), CConnman::RelayTransaction(), RequestObject(), SanitizeString(), SeenLocal(), SendBlockTransactions(), NetMsgType::SENDCMPCT, NetMsgType::SENDDSQUEUE, SENDDSQUEUE_PROTO_VERSION, NetMsgType::SENDHEADERS, SENDHEADERS_VERSION, SER_NETWORK, CNode::SetAddrLocal(), CNetAddr::SetIP(), CNode::SetRecvVersion(), CNode::SetSendVersion(), CConnman::SetServices(), SHORT_IDS_BLOCKS_VERSION, CDataStream::size(), CTxMemPool::size(), sporkManager, strprintf, CChain::Tip(), base_blob< BITS >::ToString(), CService::ToString(), COutPoint::ToStringShort(), NetMsgType::TX, CPrivateSendBroadcastTx::tx, CInv::type, CNode::vAddrToSend, NetMsgType::VERACK, NetMsgType::VERSION, CTransaction::vin, CTransaction::vout, and CNode::vRecvGetData.

Referenced by PeerLogicValidation::ProcessMessages().

◆ ProcessOrphanTx()

static void ProcessOrphanTx ( CConnman connman,
std::set< uint256 > &  orphan_work_set 
)
static

◆ RelayAddress()

static void RelayAddress ( const CAddress addr,
bool  fReachable,
CConnman connman 
)
static

◆ RequestObject() [1/2]

void RequestObject ( CNodeState *  state,
const CInv inv,
std::chrono::microseconds  current_time,
bool  fForce = false 
)

◆ RequestObject() [2/2]

void RequestObject ( NodeId  nodeId,
const CInv inv,
std::chrono::microseconds  current_time,
bool  fForce 
)

Definition at line 797 of file net_processing.cpp.

References AssertLockHeld(), cs_main, and RequestObject().

◆ SendBlockTransactions()

static void SendBlockTransactions ( const CBlock block,
const BlockTransactionsRequest req,
CNode pfrom,
CConnman connman 
)
inlinestatic

◆ SendRejectsAndCheckIfBanned()

◆ UpdateLastBlockAnnounceTime()

void UpdateLastBlockAnnounceTime ( NodeId  node,
int64_t  time_in_seconds 
)

Definition at line 819 of file net_processing.cpp.

References cs_main, and LOCK.

◆ UpdateObjectRequestTime()

void UpdateObjectRequestTime ( const uint256 hash,
std::chrono::microseconds  request_time 
)

Definition at line 709 of file net_processing.cpp.

References AssertLockHeld(), and cs_main.

Referenced by PeerLogicValidation::SendMessages().

◆ while()

Variable Documentation

◆ AVG_ADDRESS_BROADCAST_INTERVAL

const unsigned int AVG_ADDRESS_BROADCAST_INTERVAL = 30
static

Average delay between peer address broadcasts in seconds.

Definition at line 120 of file net_processing.cpp.

Referenced by PeerLogicValidation::SendMessages().

◆ AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL

constexpr unsigned int AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL = 24 * 60 * 60
static

Average delay between local address broadcasts in seconds.

Definition at line 118 of file net_processing.cpp.

Referenced by PeerLogicValidation::SendMessages().

◆ cs_most_recent_block

◆ done

◆ g_cs_orphans

static void g_cs_orphans
static

◆ g_enable_bip61

◆ GETDATA_TX_INTERVAL

constexpr std::chrono::microseconds GETDATA_TX_INTERVAL {std::chrono::seconds{60}}
static

How long to wait (in microseconds) before downloading a transaction from an additional peer.

Definition at line 69 of file net_processing.cpp.

Referenced by GetObjectInterval().

◆ HISTORICAL_BLOCK_AGE

const int HISTORICAL_BLOCK_AGE = 7 * 24 * 60 * 60
static

Age after which a block is considered historical for purposes of rate limiting block relay.

Set to one week, denominated in seconds.

Definition at line 115 of file net_processing.cpp.

Referenced by ProcessGetBlockData().

◆ INBOUND_PEER_TX_DELAY

constexpr std::chrono::microseconds INBOUND_PEER_TX_DELAY {std::chrono::seconds{2}}
static

How many microseconds to delay requesting transactions from inbound peers.

Definition at line 67 of file net_processing.cpp.

Referenced by CalculateObjectGetDataTime().

◆ instance_of_cnetprocessingcleanup

class CNetProcessingCleanup instance_of_cnetprocessingcleanup

◆ INVENTORY_BROADCAST_INTERVAL

const unsigned int INVENTORY_BROADCAST_INTERVAL = 5
static

Average delay between trickled inventory transmissions in seconds.

Blocks and whitelisted receivers bypass this, regular outbound peers get half this delay, Masternode outbound peers get quarter this delay.

Definition at line 124 of file net_processing.cpp.

Referenced by PeerLogicValidation::SendMessages().

◆ INVENTORY_BROADCAST_MAX_PER_1MB_BLOCK

constexpr unsigned int INVENTORY_BROADCAST_MAX_PER_1MB_BLOCK = 4 * 7 * INVENTORY_BROADCAST_INTERVAL
static

Maximum number of inventory items to send per transmission.

Limits the impact of low-fee transaction floods. We have 4 times smaller block times in Dash, so we need to push 4 times more invs per 1MB.

Definition at line 128 of file net_processing.cpp.

Referenced by PeerLogicValidation::SendMessages().

◆ MAX_GETDATA_RANDOM_DELAY

constexpr std::chrono::microseconds MAX_GETDATA_RANDOM_DELAY {std::chrono::seconds{2}}
static

Maximum delay (in microseconds) for transaction requests to avoid biasing some peers over others.

Definition at line 71 of file net_processing.cpp.

Referenced by GetObjectRandomDelay().

◆ MAX_GETDATA_SZ

const unsigned int MAX_GETDATA_SZ = 1000
static

Limit to avoid sending big packets.

Not used in processing incoming GETDATA for compatibility

Definition at line 77 of file net_processing.cpp.

Referenced by PeerLogicValidation::SendMessages().

◆ MAX_PEER_OBJECT_ANNOUNCEMENTS

constexpr int32_t MAX_PEER_OBJECT_ANNOUNCEMENTS = 2 * MAX_INV_SZ
static

Maximum number of announced objects from a peer.

Definition at line 65 of file net_processing.cpp.

Referenced by RequestObject().

◆ MAX_PEER_OBJECT_IN_FLIGHT

constexpr int32_t MAX_PEER_OBJECT_IN_FLIGHT = 100
static

Maximum number of in-flight objects from a peer.

Definition at line 63 of file net_processing.cpp.

Referenced by ProcessMessage(), and PeerLogicValidation::SendMessages().

◆ most_recent_block

std::shared_ptr<const CBlock> most_recent_block
static

◆ most_recent_block_hash

uint256 most_recent_block_hash
static

◆ most_recent_compact_block

std::shared_ptr<const CBlockHeaderAndShortTxIDs> most_recent_compact_block
static

◆ nMapOrphanTransactionsSize

size_t nMapOrphanTransactionsSize = 0

◆ RANDOMIZER_ID_ADDRESS_RELAY

const uint64_t RANDOMIZER_ID_ADDRESS_RELAY = 0x3cac0035b5866b90ULL
static

Definition at line 107 of file net_processing.cpp.

Referenced by RelayAddress().

◆ setMisbehaving

std::set<NodeId> setMisbehaving

Definition at line 1947 of file net_processing.cpp.

Referenced by while().

◆ STALE_RELAY_AGE_LIMIT

const int STALE_RELAY_AGE_LIMIT = 30 * 24 * 60 * 60
static

Age after which a stale block will no longer be served if requested as protection against fingerprinting.

Set to one month, denominated in seconds.

Definition at line 111 of file net_processing.cpp.

Referenced by BlockRequestAllowed().

◆ TX_EXPIRY_INTERVAL_FACTOR

constexpr int64_t TX_EXPIRY_INTERVAL_FACTOR = 10
static

How long to wait (expiry * factor microseconds) before expiring an in-flight getdata request to a peer.

Definition at line 73 of file net_processing.cpp.

Referenced by GetObjectExpiryInterval().

Released under the MIT license