Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#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>
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 CBlock > | most_recent_block |
static std::shared_ptr< const CBlockHeaderAndShortTxIDs > | most_recent_compact_block |
static uint256 | most_recent_block_hash |
std::set< NodeId > | setMisbehaving |
bool | done = false |
class CNetProcessingCleanup | instance_of_cnetprocessingcleanup |
Function Documentation
◆ AddOrphanTx()
bool AddOrphanTx | ( | const CTransactionRef & | tx, |
NodeId | peer | ||
) |
Definition at line 911 of file net_processing.cpp.
References AddToCompactExtraTransactions(), CTransaction::CURRENT_VERSION, GetSerializeSize(), GetTime(), LogPrint, MAX_STANDARD_TX_SIZE, BCLog::MEMPOOL, nMapOrphanTransactionsSize, ORPHAN_TX_EXPIRE_TIME, CTxIn::prevout, SER_NETWORK, and base_blob< BITS >::ToString().
Referenced by ProcessMessage().
◆ AddToCompactExtraTransactions()
void AddToCompactExtraTransactions | ( | const CTransactionRef & | tx | ) |
Definition at line 900 of file net_processing.cpp.
References DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN, gArgs, and ArgsManager::GetArg().
Referenced by AddOrphanTx(), and ProcessMessage().
◆ AlreadyHave()
|
static |
Definition at line 1256 of file net_processing.cpp.
References llmq::CDKGSessionManager::AlreadyHave(), llmq::CChainLocksHandler::AlreadyHave(), llmq::CSigningManager::AlreadyHave(), llmq::CInstantSendManager::AlreadyHave(), chainActive, llmq::chainLocksHandler, CGovernanceManager::ConfirmInventoryRequest(), CTxMemPool::exists(), fTxIndex, g_cs_orphans, CBlockIndex::GetBlockHash(), CPrivateSend::GetDSTX(), CSporkManager::GetSporkByHash(), governance, llmq::CQuorumBlockProcessor::HasMinableCommitment(), llmq::CInstantSendManager::IsLocked(), LOCK, mapBlockIndex, mempool, MSG_BLOCK, MSG_CLSIG, MSG_DSTX, MSG_GOVERNANCE_OBJECT, MSG_GOVERNANCE_OBJECT_VOTE, MSG_ISLOCK, MSG_LEGACY_TXLOCK_REQUEST, MSG_QUORUM_COMPLAINT, MSG_QUORUM_CONTRIB, MSG_QUORUM_FINAL_COMMITMENT, MSG_QUORUM_JUSTIFICATION, MSG_QUORUM_PREMATURE_COMMITMENT, MSG_QUORUM_RECOVERED_SIG, MSG_SPORK, MSG_TX, pblocktree, pcoinsTip, llmq::quorumBlockProcessor, llmq::quorumDKGSessionManager, llmq::quorumInstantSendManager, llmq::quorumSigningManager, spork(), sporkManager, and CChain::Tip().
Referenced by ProcessMessage(), and PeerLogicValidation::SendMessages().
◆ 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()
|
static |
Definition at line 1070 of file net_processing.cpp.
References AssertLockHeld(), BLOCK_VALID_SCRIPTS, chainActive, CChain::Contains(), cs_main, GetBlockProofEquivalentTime(), CBlockIndex::GetBlockTime(), CBlockIndex::IsValid(), pindexBestHeader, and STALE_RELAY_AGE_LIMIT.
Referenced by ProcessGetBlockData(), and ProcessMessage().
◆ CalculateObjectGetDataTime()
std::chrono::microseconds CalculateObjectGetDataTime | ( | const CInv & | inv, |
std::chrono::microseconds | current_time, | ||
bool | use_inbound_delay | ||
) |
Definition at line 749 of file net_processing.cpp.
References AssertLockHeld(), cs_main, fMasternodeMode, GetObjectInterval(), GetObjectRandomDelay(), GetObjectRequestTime(), INBOUND_PEER_TX_DELAY, and MSG_TX.
Referenced by RequestObject(), and PeerLogicValidation::SendMessages().
◆ EraseObjectRequest() [1/2]
void EraseObjectRequest | ( | CNodeState * | nodestate, |
const CInv & | inv | ||
) |
Definition at line 676 of file net_processing.cpp.
References AssertLockHeld(), cs_main, LogPrint, and BCLog::NET.
Referenced by EraseObjectRequest(), llmq::CInstantSendManager::ProcessInstantSendLock(), llmq::CQuorumBlockProcessor::ProcessMessage(), CGovernanceManager::ProcessMessage(), ProcessMessage(), llmq::CChainLocksHandler::ProcessNewChainLock(), llmq::ProcessPendingMessageBatch(), llmq::CSigningManager::ProcessRecoveredSig(), CSporkManager::ProcessSpork(), and llmq::CDKGPendingMessages::PushPendingMessage().
◆ EraseObjectRequest() [2/2]
Definition at line 689 of file net_processing.cpp.
References AssertLockHeld(), cs_main, and EraseObjectRequest().
◆ EraseOrphansFor()
void EraseOrphansFor | ( | NodeId | peer | ) |
Definition at line 966 of file net_processing.cpp.
References EraseOrphanTx(), g_cs_orphans, LOCK, LogPrint, and BCLog::MEMPOOL.
Referenced by PeerLogicValidation::FinalizeNode().
◆ EraseOrphanTx()
|
static |
Definition at line 946 of file net_processing.cpp.
References nMapOrphanTransactionsSize, and CTxIn::prevout.
Referenced by PeerLogicValidation::BlockConnected(), EraseOrphansFor(), LimitOrphanTxSize(), and while().
◆ GetNodeStateStats()
bool GetNodeStateStats | ( | NodeId | nodeid, |
CNodeStateStats & | stats | ||
) |
Get statistics from node state.
Definition at line 880 of file net_processing.cpp.
References cs_main, LOCK, CNodeStateStats::nCommonHeight, CNodeStateStats::nMisbehavior, CNodeStateStats::nSyncHeight, and CNodeStateStats::vHeightInFlight.
Referenced by getpeerinfo(), and PeerTablePriv::refreshPeers().
◆ GetObjectExpiryInterval()
std::chrono::microseconds GetObjectExpiryInterval | ( | int | invType | ) |
Definition at line 736 of file net_processing.cpp.
References GetObjectInterval(), and TX_EXPIRY_INTERVAL_FACTOR.
Referenced by PeerLogicValidation::SendMessages().
◆ GetObjectInterval()
std::chrono::microseconds GetObjectInterval | ( | int | invType | ) |
Definition at line 720 of file net_processing.cpp.
References GETDATA_TX_INTERVAL, MSG_CLSIG, MSG_ISLOCK, and MSG_QUORUM_RECOVERED_SIG.
Referenced by CalculateObjectGetDataTime(), GetObjectExpiryInterval(), and PeerLogicValidation::SendMessages().
◆ 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 | ) |
Definition at line 1045 of file net_processing.cpp.
Referenced by llmq::CSigSharesManager::RemoveBannedNodeStates().
◆ IsOutboundDisconnectionCandidate()
bool IsOutboundDisconnectionCandidate | ( | const CNode * | node | ) |
Definition at line 828 of file net_processing.cpp.
References CNode::fFeeler, CNode::fInbound, CNode::fOneShot, and CNode::m_manual_connection.
Referenced by PeerLogicValidation::ConsiderEviction(), PeerLogicValidation::EvictExtraOutboundPeers(), and ProcessHeadersMessage().
◆ LimitOrphanTxSize()
unsigned int LimitOrphanTxSize | ( | unsigned int | nMaxOrphansSize | ) |
Definition at line 983 of file net_processing.cpp.
References EraseOrphanTx(), g_cs_orphans, GetRandHash(), GetTime(), LOCK, LogPrint, BCLog::MEMPOOL, nMapOrphanTransactionsSize, ORPHAN_TX_EXPIRE_INTERVAL, and ORPHAN_TX_EXPIRE_TIME.
Referenced by ProcessMessage().
◆ Misbehaving()
void Misbehaving | ( | NodeId | nodeid, |
int | howmuch, | ||
const std::string & | message = "" |
||
) |
Increase a node's misbehavior score.
Definition at line 1024 of file net_processing.cpp.
References DEFAULT_BANSCORE_THRESHOLD, gArgs, ArgsManager::GetArg(), LogPrint, and BCLog::NET.
Referenced by llmq::CSigSharesManager::BanNode(), PeerLogicValidation::BlockChecked(), ProcessHeadersMessage(), llmq::CQuorumBlockProcessor::ProcessMessage(), CMNAuth::ProcessMessage(), llmq::CDKGSessionManager::ProcessMessage(), CPrivateSendServer::ProcessMessage(), CPrivateSendClientManager::ProcessMessage(), CGovernanceManager::ProcessMessage(), ProcessMessage(), llmq::CInstantSendManager::ProcessMessageInstantSendLock(), llmq::CSigningManager::ProcessMessageRecoveredSig(), llmq::CChainLocksHandler::ProcessNewChainLock(), llmq::CInstantSendManager::ProcessPendingInstantSendLocks(), llmq::ProcessPendingMessageBatch(), llmq::CSigningManager::ProcessPendingRecoveredSigs(), CSporkManager::ProcessSpork(), SendBlockTransactions(), CGovernanceManager::SyncObjects(), and while().
◆ nTimeBestReceived()
std::atomic<int64_t> nTimeBestReceived | ( | 0 | ) |
Referenced by PeerLogicValidation::SendMessages().
◆ ProcessGetBlockData()
|
static |
Definition at line 1380 of file net_processing.cpp.
References ActivateBestChain(), NetMsgType::BLOCK, BLOCK_HAVE_DATA, BLOCK_VALID_SCRIPTS, BLOCK_VALID_TREE, BlockRequestAllowed(), chainActive, NetMsgType::CMPCTBLOCK, CNode::cs_filter, cs_main, cs_most_recent_block, CNode::fDisconnect, CNode::fWhitelisted, CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockTime(), CChainParams::GetConsensus(), CNode::GetId(), CNode::GetLocalServices(), CNode::GetSendVersion(), CInv::hash, CNode::hashContinue, CChain::Height(), HISTORICAL_BLOCK_AGE, NetMsgType::INV, LOCK, LogPrint, mapBlockIndex, MAX_CMPCTBLOCK_DEPTH, NetMsgType::MERKLEBLOCK, most_recent_block, most_recent_compact_block, MSG_BLOCK, MSG_CMPCT_BLOCK, MSG_FILTERED_BLOCK, BCLog::NET, CBlockIndex::nHeight, NODE_NETWORK, NODE_NETWORK_LIMITED, NODE_NETWORK_LIMITED_MIN_BLOCKS, CConnman::OutboundTargetReached(), Params(), pindexBestHeader, CConnman::PushMessage(), ReadBlockFromDisk(), base_blob< BITS >::SetNull(), CChain::Tip(), NetMsgType::TX, CInv::type, and CMerkleBlock::vMatchedTxn.
Referenced by ProcessGetData().
◆ ProcessGetData()
|
static |
Definition at line 1517 of file net_processing.cpp.
References AssertLockNotHeld, llmq::chainLocksHandler, NetMsgType::CLSIG, cs_main, NetMsgType::DSTX, CNode::fPauseSend, CPrivateSend::GetDSTX(), CNode::GetSendVersion(), CSporkManager::GetSporkByHash(), governance, CInv::hash, CGovernanceManager::HaveObjectForHash(), CGovernanceManager::HaveVoteForHash(), CTxMemPool::info(), NetMsgType::ISLOCK, LOCK, LogPrint, mempool, NetMsgType::MNGOVERNANCEOBJECT, NetMsgType::MNGOVERNANCEOBJECTVOTE, MSG_BLOCK, MSG_CLSIG, MSG_CMPCT_BLOCK, MSG_DSTX, MSG_FILTERED_BLOCK, MSG_GOVERNANCE_OBJECT, MSG_GOVERNANCE_OBJECT_VOTE, MSG_ISLOCK, MSG_QUORUM_COMPLAINT, MSG_QUORUM_CONTRIB, MSG_QUORUM_FINAL_COMMITMENT, MSG_QUORUM_JUSTIFICATION, MSG_QUORUM_PREMATURE_COMMITMENT, MSG_QUORUM_RECOVERED_SIG, MSG_SPORK, MSG_TX, BCLog::NET, NetMsgType::NOTFOUND, ProcessGetBlockData(), CConnman::PushMessage(), NetMsgType::QCOMPLAINT, NetMsgType::QCONTRIB, NetMsgType::QFCOMMITMENT, NetMsgType::QJUSTIFICATION, NetMsgType::QPCOMMITMENT, NetMsgType::QSIGREC, llmq::quorumBlockProcessor, llmq::quorumDKGSessionManager, llmq::quorumInstantSendManager, llmq::quorumSigningManager, CDataStream::reserve(), SER_NETWORK, CGovernanceManager::SerializeObjectForHash(), CGovernanceManager::SerializeVoteForHash(), NetMsgType::SPORK, spork(), sporkManager, CNode::timeLastMempoolReq, CInv::ToString(), NetMsgType::TX, CInv::type, and CNode::vRecvGetData.
Referenced by ProcessMessage(), and PeerLogicValidation::ProcessMessages().
◆ ProcessHeadersMessage()
|
static |
Definition at line 1724 of file net_processing.cpp.
References BLOCK_HAVE_DATA, BLOCK_VALID_CHAIN, BLOCK_VALID_TREE, chainActive, CChain::Contains(), cs_main, CNode::fDisconnect, CBlockIndex::GetBlockHash(), CChainParams::GetConsensus(), NetMsgType::GETDATA, CBlockHeader::GetHash(), NetMsgType::GETHEADERS, CNode::GetId(), CChain::GetLocator(), CNode::GetSendVersion(), GetTime(), IsInitialBlockDownload(), CValidationState::IsInvalid(), base_blob< BITS >::IsNull(), IsOutboundDisconnectionCandidate(), CBlockIndex::IsValid(), LOCK, LogPrint, LogPrintf, mapBlockIndex, MAX_BLOCKS_IN_TRANSIT_PER_PEER, MAX_BLOCKS_TO_ANNOUNCE, MAX_HEADERS_RESULTS, MAX_UNCONNECTING_HEADERS, Misbehaving(), MSG_BLOCK, MSG_CMPCT_BLOCK, CBlockIndex::nChainWork, BCLog::NET, CBlockIndex::nHeight, nMinimumChainWork, CNode::nStartingHeight, CBlockIndex::nStatus, pindexBestHeader, CBlockIndex::pprev, ProcessNewBlockHeaders(), CConnman::PushMessage(), reverse_iterate(), CChain::Tip(), and base_blob< BITS >::ToString().
Referenced by ProcessMessage().
◆ ProcessMessage()
|
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()
Referenced by PeerLogicValidation::BlockConnected(), ProcessMessage(), and PeerLogicValidation::ProcessMessages().
◆ RelayAddress()
Definition at line 1344 of file net_processing.cpp.
References CADDR_TIME_VERSION, immer::copy(), CConnman::ForEachNodeThen(), CConnman::GetDeterministicRandomizer(), CNetAddr::GetHash(), CNode::GetId(), GetTime(), CNode::nVersion, RANDOMIZER_ID_ADDRESS_RELAY, and CSipHasher::Write().
Referenced by ProcessMessage().
◆ RequestObject() [1/2]
void RequestObject | ( | CNodeState * | state, |
const CInv & | inv, | ||
std::chrono::microseconds | current_time, | ||
bool | fForce = false |
||
) |
Definition at line 769 of file net_processing.cpp.
References AssertLockHeld(), CalculateObjectGetDataTime(), count, cs_main, CInv::hash, LogPrint, MAX_PEER_OBJECT_ANNOUNCEMENTS, BCLog::NET, and CInv::ToString().
Referenced by llmq::CInstantSendManager::AskNodesForLockedTx(), ProcessMessage(), and RequestObject().
◆ 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()
|
inlinestatic |
Definition at line 1709 of file net_processing.cpp.
References NetMsgType::BLOCKTXN, cs_main, CNode::GetId(), CNode::GetSendVersion(), BlockTransactionsRequest::indexes, LOCK, Misbehaving(), CConnman::PushMessage(), strprintf, BlockTransactions::txn, and CBlock::vtx.
Referenced by ProcessMessage().
◆ SendRejectsAndCheckIfBanned()
Definition at line 3510 of file net_processing.cpp.
References CNode::addr, AssertLockHeld(), CConnman::Ban(), BanReasonNodeMisbehaving, NetMsgType::BLOCK, cs_main, CNode::fDisconnect, CNode::fWhitelisted, g_enable_bip61, CNode::GetId(), CNode::GetLogString(), INIT_PROTO_VERSION, CNetAddr::IsLocal(), LogPrintf, CNode::m_manual_connection, CConnman::PushMessage(), and NetMsgType::REJECT.
Referenced by PeerLogicValidation::ProcessMessages(), and PeerLogicValidation::SendMessages().
◆ UpdateLastBlockAnnounceTime()
void UpdateLastBlockAnnounceTime | ( | NodeId | node, |
int64_t | time_in_seconds | ||
) |
Definition at line 819 of file net_processing.cpp.
◆ 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()
while | ( | !done &&!orphan_work_set. | empty() | ) |
Definition at line 1949 of file net_processing.cpp.
References AcceptToMemoryPool(), base_blob< BITS >::begin(), CTxMemPool::check(), CValidationState::CorruptionPossible(), done, EraseOrphanTx(), CValidationState::IsInvalid(), LogPrint, BCLog::MEMPOOL, mempool, Misbehaving(), pcoinsTip, CConnman::RelayTransaction(), setMisbehaving, base_blob< BITS >::ToString(), and CTransaction::vout.
Referenced by rest_headers().
Variable Documentation
◆ AVG_ADDRESS_BROADCAST_INTERVAL
|
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
|
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
|
static |
Definition at line 1140 of file net_processing.cpp.
Referenced by PeerLogicValidation::NewPoWValidBlock(), ProcessGetBlockData(), ProcessMessage(), and PeerLogicValidation::SendMessages().
◆ done
bool done = false |
Definition at line 1948 of file net_processing.cpp.
Referenced by CWallet::AbandonTransaction(), CoinControlDialog::buttonBoxClicked(), AddressBookPage::done(), CWallet::MarkConflicted(), CConnman::ThreadOpenConnections(), and while().
◆ g_cs_orphans
|
static |
Definition at line 98 of file net_processing.cpp.
Referenced by AlreadyHave(), PeerLogicValidation::BlockConnected(), EraseOrphansFor(), LimitOrphanTxSize(), ProcessMessage(), and PeerLogicValidation::ProcessMessages().
◆ g_enable_bip61
bool g_enable_bip61 = DEFAULT_ENABLE_BIP61 |
Enable BIP61 (sending reject messages)
Definition at line 80 of file net_processing.cpp.
Referenced by AppInitParameterInteraction(), CPrivateSendServer::ProcessMessage(), CPrivateSendClientSession::ProcessMessage(), CPrivateSendClientManager::ProcessMessage(), CGovernanceManager::ProcessMessage(), ProcessMessage(), PeerLogicValidation::ProcessMessages(), and SendRejectsAndCheckIfBanned().
◆ GETDATA_TX_INTERVAL
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
static |
Definition at line 1141 of file net_processing.cpp.
Referenced by PeerLogicValidation::NewPoWValidBlock(), ProcessGetBlockData(), and ProcessMessage().
◆ most_recent_block_hash
|
static |
Definition at line 1143 of file net_processing.cpp.
Referenced by PeerLogicValidation::NewPoWValidBlock(), ProcessMessage(), and PeerLogicValidation::SendMessages().
◆ most_recent_compact_block
|
static |
Definition at line 1142 of file net_processing.cpp.
Referenced by PeerLogicValidation::NewPoWValidBlock(), ProcessGetBlockData(), and PeerLogicValidation::SendMessages().
◆ nMapOrphanTransactionsSize
size_t nMapOrphanTransactionsSize = 0 |
Definition at line 101 of file net_processing.cpp.
Referenced by AddOrphanTx(), EraseOrphanTx(), LimitOrphanTxSize(), and CNetProcessingCleanup::~CNetProcessingCleanup().
◆ RANDOMIZER_ID_ADDRESS_RELAY
|
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
|
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
|
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().