Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <net_processing.h>
Public Member Functions | |
PeerLogicValidation (CConnman *connmanIn, CScheduler &scheduler) | |
void | BlockConnected (const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexConnected, const std::vector< CTransactionRef > &vtxConflicted) override |
Notifies listeners of a block being connected. More... | |
void | UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override |
Notifies listeners of updated block chain tip. More... | |
void | BlockChecked (const CBlock &block, const CValidationState &state) override |
Notifies listeners of a block validation result. More... | |
void | NewPoWValidBlock (const CBlockIndex *pindex, const std::shared_ptr< const CBlock > &pblock) override |
Notifies listeners that a block which builds directly on our current tip has been received and connected to the headers tree, though not validated yet. More... | |
void | InitializeNode (CNode *pnode) override |
void | FinalizeNode (NodeId nodeid, bool &fUpdateConnectionTime) override |
bool | ProcessMessages (CNode *pfrom, std::atomic< bool > &interrupt) override |
Process protocol messages received from a given node. More... | |
bool | SendMessages (CNode *pto, std::atomic< bool > &interrupt) override |
Send queued protocol messages to be sent to a give node. More... | |
void | ConsiderEviction (CNode *pto, int64_t time_in_seconds) |
void | CheckForStaleTipAndEvictPeers (const Consensus::Params &consensusParams) |
void | EvictExtraOutboundPeers (int64_t time_in_seconds) |
Private Attributes | |
CConnman *const | connman |
int64_t | m_stale_tip_check_time |
Additional Inherited Members | |
Protected Member Functions inherited from CValidationInterface | |
virtual void | AcceptedBlockHeader (const CBlockIndex *pindexNew) |
virtual void | NotifyHeaderTip (const CBlockIndex *pindexNew, bool fInitialDownload) |
virtual void | SynchronousUpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) |
Same as UpdatedBlockTip, but called from the caller's thread. More... | |
virtual void | TransactionAddedToMempool (const CTransactionRef &ptxn, int64_t nAcceptTime) |
Notifies listeners of a transaction having been added to mempool. More... | |
virtual void | TransactionRemovedFromMempool (const CTransactionRef &ptx) |
Notifies listeners of a transaction leaving mempool. More... | |
virtual void | BlockDisconnected (const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindexDisconnected) |
Notifies listeners of a block being disconnected. More... | |
virtual void | NotifyTransactionLock (const CTransaction &tx, const llmq::CInstantSendLock &islock) |
virtual void | NotifyChainLock (const CBlockIndex *pindex, const llmq::CChainLockSig &clsig) |
virtual void | NotifyGovernanceVote (const CGovernanceVote &vote) |
virtual void | NotifyGovernanceObject (const CGovernanceObject &object) |
virtual void | NotifyInstantSendDoubleSpendAttempt (const CTransaction ¤tTx, const CTransaction &previousTx) |
virtual void | NotifyMasternodeListChanged (bool undo, const CDeterministicMNList &oldMNList, const CDeterministicMNListDiff &diff) |
virtual void | SetBestChain (const CBlockLocator &locator) |
Notifies listeners of the new active block chain on-disk. More... | |
virtual void | ResendWalletTransactions (int64_t nBestBlockTime, CConnman *connman) |
Tells listeners to broadcast their data. More... | |
friend | void ::RegisterValidationInterface (CValidationInterface *) |
friend | void ::UnregisterValidationInterface (CValidationInterface *) |
friend | void ::UnregisterAllValidationInterfaces () |
Detailed Description
Definition at line 45 of file net_processing.h.
Constructor & Destructor Documentation
◆ PeerLogicValidation()
|
explicit |
Definition at line 1079 of file net_processing.cpp.
References CheckForStaleTipAndEvictPeers(), EXTRA_PEER_CHECK_INTERVAL, CChainParams::GetConsensus(), Params(), CScheduler::scheduleEvery(), scheduler, and STALE_CHECK_INTERVAL.
Member Function Documentation
◆ BlockChecked()
|
overridevirtual |
Notifies listeners of a block validation result.
If the provided CValidationState IsValid, the provided block is guaranteed to be the current best block at the time the callback was generated (not necessarily now)
Reimplemented from CValidationInterface.
Definition at line 1217 of file net_processing.cpp.
References connman, cs_main, CBlockHeader::GetHash(), CValidationState::GetRejectCode(), CValidationState::GetRejectReason(), IsInitialBlockDownload(), CValidationState::IsInvalid(), CValidationState::IsValid(), LOCK, MAX_REJECT_MESSAGE_LENGTH, Misbehaving(), and REJECT_INTERNAL.
◆ BlockConnected()
|
overridevirtual |
Notifies listeners of a block being connected.
Provides a vector of transactions evicted from the mempool as a result.
Called on a background thread.
Reimplemented from CValidationInterface.
Definition at line 1092 of file net_processing.cpp.
References cs_main, EraseOrphanTx(), g_connman, g_cs_orphans, CTransaction::GetHash(), GetTime(), LOCK2, LogPrint, BCLog::MEMPOOL, ProcessOrphanTx(), and CTransaction::vin.
◆ CheckForStaleTipAndEvictPeers()
void PeerLogicValidation::CheckForStaleTipAndEvictPeers | ( | const Consensus::Params & | consensusParams | ) |
Definition at line 3777 of file net_processing.cpp.
References connman, cs_main, EvictExtraOutboundPeers(), GetTime(), CConnman::GetTryNewOutboundPeer(), LOCK, LogPrintf, m_stale_tip_check_time, CConnman::SetTryNewOutboundPeer(), and STALE_CHECK_INTERVAL.
Referenced by PeerLogicValidation().
◆ ConsiderEviction()
void PeerLogicValidation::ConsiderEviction | ( | CNode * | pto, |
int64_t | time_in_seconds | ||
) |
Definition at line 3667 of file net_processing.cpp.
References AssertLockHeld(), CHAIN_SYNC_TIMEOUT, chainActive, connman, cs_main, CNode::fDisconnect, NetMsgType::GETHEADERS, CNode::GetId(), CChain::GetLocator(), CNode::GetSendVersion(), IsOutboundDisconnectionCandidate(), LogPrint, LogPrintf, CBlockIndex::nChainWork, BCLog::NET, CConnman::PushMessage(), and CChain::Tip().
Referenced by SendMessages().
◆ EvictExtraOutboundPeers()
void PeerLogicValidation::EvictExtraOutboundPeers | ( | int64_t | time_in_seconds | ) |
Definition at line 3720 of file net_processing.cpp.
References connman, cs_main, CNode::fDisconnect, CNode::fMasternode, CConnman::ForEachNode(), CConnman::ForNode(), CConnman::GetExtraOutboundCount(), CNode::GetId(), IsOutboundDisconnectionCandidate(), LOCK, LogPrint, MINIMUM_CONNECT_TIME, BCLog::NET, CNode::nTimeConnected, and CConnman::SetTryNewOutboundPeer().
Referenced by CheckForStaleTipAndEvictPeers().
◆ FinalizeNode()
|
overridevirtual |
Implements NetEventsInterface.
Definition at line 845 of file net_processing.cpp.
References cs_main, EraseOrphansFor(), LOCK, LogPrint, and BCLog::NET.
◆ InitializeNode()
|
overridevirtual |
Implements NetEventsInterface.
Definition at line 833 of file net_processing.cpp.
References CNode::addr, connman, cs_main, CNode::fInbound, CNode::GetAddrName(), CNode::GetId(), GetTime(), and LOCK.
◆ NewPoWValidBlock()
|
overridevirtual |
Notifies listeners that a block which builds directly on our current tip has been received and connected to the headers tree, though not validated yet.
Reimplemented from CValidationInterface.
Definition at line 1145 of file net_processing.cpp.
References NetMsgType::CMPCTBLOCK, connman, cs_main, cs_most_recent_block, CNode::fDisconnect, CConnman::ForEachNode(), CNode::GetId(), LOCK, LogPrint, CNetMsgMaker::Make(), most_recent_block, most_recent_block_hash, most_recent_compact_block, BCLog::NET, CBlockIndex::nHeight, CBlockIndex::pprev, PROTOCOL_VERSION, and CConnman::PushMessage().
◆ ProcessMessages()
|
overridevirtual |
Process protocol messages received from a given node.
Implements NetEventsInterface.
Definition at line 3542 of file net_processing.cpp.
References base_blob< BITS >::begin(), CMessageHeader::CHECKSUM_SIZE, connman, cs_main, CNode::cs_vProcessMsg, CNode::fDisconnect, CNode::fPauseRecv, CNode::fPauseSend, g_cs_orphans, g_enable_bip61, CMessageHeader::GetCommand(), CNode::GetId(), CConnman::GetReceiveFloodSize(), CNode::GetRecvVersion(), CMessageHeader::HEADER_SIZE, HexStr(), INIT_PROTO_VERSION, CMessageHeader::IsValid(), LOCK, LOCK2, LogPrint, CMessageHeader::MESSAGE_START_SIZE, CChainParams::MessageStart(), BCLog::NET, CMessageHeader::nMessageSize, CNode::nProcessQueueSize, CNode::orphan_work_set, Params(), CMessageHeader::pchChecksum, PrintExceptionContinue(), ProcessGetData(), ProcessMessage(), ProcessOrphanTx(), CConnman::PushMessage(), NetMsgType::REJECT, REJECT_MALFORMED, SanitizeString(), SendRejectsAndCheckIfBanned(), CNetMessage::SetVersion(), and CNode::vRecvGetData.
◆ SendMessages()
|
overridevirtual |
Send queued protocol messages to be sent to a give node.
- Parameters
-
[in] pto The node which we are sending messages to. [in] interrupt Interrupt condition for processing threads
- Returns
- True if there is more work to be done
Implements NetEventsInterface.
Definition at line 3816 of file net_processing.cpp.
References NetMsgType::ADDR, CNode::addrKnown, AdvertiseLocal(), AlreadyHave(), AVG_ADDRESS_BROADCAST_INTERVAL, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL, BIP0031_VERSION, BLOCK_DOWNLOAD_TIMEOUT_BASE, BLOCK_DOWNLOAD_TIMEOUT_PER_PEER, BLOCK_STALLING_TIMEOUT, CMainSignals::Broadcast(), CalculateObjectGetDataTime(), chainActive, NetMsgType::CMPCTBLOCK, connman, ConsiderEviction(), CRollingBloomFilter::contains(), count, CTxMemPool::cs, CNode::cs_filter, CNode::cs_inventory, cs_main, cs_most_recent_block, CNode::fClient, CNode::fDisconnect, fImporting, CNode::fInbound, CNode::fMasternode, fMasternodeMode, CNode::fOneShot, CNode::fPingQueued, fReindex, CNode::fRelayTxes, CNode::fSendMempool, CNode::fSuccessfullyConnected, CNode::fWhitelisted, GetAdjustedTime(), CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockTime(), CChainParams::GetConsensus(), NetMsgType::GETDATA, CPrivateSend::GetDSTX(), NetMsgType::GETHEADERS, CNode::GetId(), CService::GetKey(), CChain::GetLocator(), GetMainSignals(), GetObjectExpiryInterval(), GetObjectInterval(), GetObjectRequestTime(), GetRandBytes(), GetRandMicros(), CNode::GetSendVersion(), GetTime(), GetTimeMicros(), CInv::hash, Consensus::Params::hashDevnetGenesisBlock, NetMsgType::HEADERS, HEADERS_DOWNLOAD_TIMEOUT_BASE, HEADERS_DOWNLOAD_TIMEOUT_PER_HEADER, CTxMemPool::info(), CTxMemPool::infoAll(), CRollingBloomFilter::insert(), NetMsgType::INV, INVENTORY_BROADCAST_INTERVAL, INVENTORY_BROADCAST_MAX_PER_1MB_BLOCK, IsInitialBlockDownload(), base_blob< BITS >::IsNull(), LOCK, LOCK2, LogPrint, LogPrintf, CNode::m_limited_node, mapBlockIndex, MAX_BLOCKS_IN_TRANSIT_PER_PEER, MAX_BLOCKS_TO_ANNOUNCE, MAX_GETDATA_SZ, MAX_INV_SZ, MAX_PEER_OBJECT_IN_FLIGHT, MaxBlockSize(), mempool, most_recent_block_hash, most_recent_compact_block, MSG_BLOCK, MSG_DSTX, MSG_ISLOCK, MSG_TX, BCLog::NET, CBlockIndex::nHeight, nMaxTipAge, CNode::nNextInvSend, CNode::nPingNonceSent, CNode::nPingUsecStart, Consensus::Params::nPowTargetSpacing, CNode::nStartingHeight, nTimeBestReceived(), CNode::nVersion, Params(), pindexBestHeader, NetMsgType::PING, PING_INTERVAL, PoissonNextSend(), CConnman::PoissonNextSendInbound(), CBlockIndex::pprev, CNode::PushInventory(), CConnman::PushMessage(), llmq::quorumInstantSendManager, ReadBlockFromDisk(), SendRejectsAndCheckIfBanned(), CNode::setInventoryTxToSend, CNode::timeLastMempoolReq, CChain::Tip(), base_blob< BITS >::ToString(), CInv::ToString(), TRY_LOCK, CInv::type, UpdateObjectRequestTime(), CNode::vAddrToSend, CNode::vBlockHashesToAnnounce, CNode::verifiedProRegTxHash, and CNode::vInventoryOtherToSend.
◆ UpdatedBlockTip()
|
overridevirtual |
Notifies listeners of updated block chain tip.
Called on a background thread.
Reimplemented from CValidationInterface.
Definition at line 1184 of file net_processing.cpp.
References connman, CNode::fMasternode, CConnman::ForEachNode(), CBlockIndex::GetBlockHash(), MAX_BLOCKS_TO_ANNOUNCE, CBlockIndex::nHeight, CNode::nStartingHeight, CBlockIndex::pprev, CConnman::SetBestHeight(), SetServiceFlagsIBDCache(), and CConnman::WakeMessageHandler().
Member Data Documentation
◆ connman
|
private |
Definition at line 47 of file net_processing.h.
Referenced by BlockChecked(), CheckForStaleTipAndEvictPeers(), ConsiderEviction(), EvictExtraOutboundPeers(), InitializeNode(), NewPoWValidBlock(), ProcessMessages(), SendMessages(), and UpdatedBlockTip().
◆ m_stale_tip_check_time
|
private |
Definition at line 76 of file net_processing.h.
Referenced by CheckForStaleTipAndEvictPeers().
The documentation for this class was generated from the following files:
- src/net_processing.h
- src/net_processing.cpp