Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

PeerLogicValidation Class Reference

#include <net_processing.h>

+ Inheritance diagram for PeerLogicValidation:
+ Collaboration diagram for PeerLogicValidation:

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 &currentTx, 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()

PeerLogicValidation::PeerLogicValidation ( CConnman connmanIn,
CScheduler scheduler 
)
explicit

Member Function Documentation

◆ BlockChecked()

void PeerLogicValidation::BlockChecked ( const CBlock ,
const CValidationState  
)
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()

void PeerLogicValidation::BlockConnected ( const std::shared_ptr< const CBlock > &  block,
const CBlockIndex pindex,
const std::vector< CTransactionRef > &  txnConflicted 
)
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)

◆ ConsiderEviction()

◆ EvictExtraOutboundPeers()

◆ FinalizeNode()

void PeerLogicValidation::FinalizeNode ( NodeId  nodeid,
bool &  fUpdateConnectionTime 
)
overridevirtual

Implements NetEventsInterface.

Definition at line 845 of file net_processing.cpp.

References cs_main, EraseOrphansFor(), LOCK, LogPrint, and BCLog::NET.

◆ InitializeNode()

void PeerLogicValidation::InitializeNode ( CNode pnode)
overridevirtual

◆ NewPoWValidBlock()

void PeerLogicValidation::NewPoWValidBlock ( const CBlockIndex pindex,
const std::shared_ptr< const CBlock > &  block 
)
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()

◆ SendMessages()

bool PeerLogicValidation::SendMessages ( CNode pto,
std::atomic< bool > &  interrupt 
)
overridevirtual

Send queued protocol messages to be sent to a give node.

Parameters
[in]ptoThe node which we are sending messages to.
[in]interruptInterrupt 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()

void PeerLogicValidation::UpdatedBlockTip ( const CBlockIndex pindexNew,
const CBlockIndex pindexFork,
bool  fInitialDownload 
)
overridevirtual

Member Data Documentation

◆ connman

◆ m_stale_tip_check_time

int64_t PeerLogicValidation::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:
Released under the MIT license