Bitcoin ABC  0.22.15
P2P Digital Currency
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
avalanche::Processor Class Reference

#include <processor.h>

Collaboration diagram for avalanche::Processor:
[legend]

Classes

class  NotificationsHandler
 
struct  PeerData
 
struct  Query
 

Public Member Functions

 Processor (interfaces::Chain &chain, CConnman *connmanIn, NodePeerManager *nodePeerManagerIn)
 
 ~Processor ()
 
void setQueryTimeoutDuration (std::chrono::milliseconds d)
 
bool addBlockToReconcile (const CBlockIndex *pindex)
 
bool isAccepted (const CBlockIndex *pindex) const
 
int getConfidence (const CBlockIndex *pindex) const
 
void sendResponse (CNode *pfrom, Response response) const
 
bool registerVotes (NodeId nodeid, const Response &response, std::vector< BlockUpdate > &updates)
 
bool addNode (NodeId nodeid, const Proof &proof, const Delegation &delegation)
 
bool forNode (NodeId nodeid, std::function< bool(const Node &n)> func) const
 
CPubKey getSessionPubKey () const
 
bool sendHello (CNode *pfrom) const
 
bool startEventLoop (CScheduler &scheduler)
 
bool stopEventLoop ()
 

Private Types

using QuerySet = boost::multi_index_container< Query, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::composite_key< Query, boost::multi_index::member< Query, NodeId, &Query::nodeid >, boost::multi_index::member< Query, uint64_t, &Query::round > >>, boost::multi_index::ordered_non_unique< boost::multi_index::tag< query_timeout >, boost::multi_index::member< Query, TimePoint, &Query::timeout > >> >
 

Private Member Functions

std::unique_ptr< PeerManager > peerManager GUARDED_BY (cs_peerManager)
 
void runEventLoop ()
 
void clearTimedoutRequests ()
 
std::vector< CInvgetInvsForNextPoll (bool forPoll=true)
 
NodeId getSuitableNodeToQuery ()
 

Private Attributes

CConnmanconnman
 
NodePeerManagernodePeerManager
 
std::chrono::milliseconds queryTimeoutDuration
 
RWCollection< BlockVoteMapvote_records
 Blocks to run avalanche on. More...
 
std::atomic< uint64_t > round
 Keep track of peers and queries sent. More...
 
Mutex cs_peerManager
 Keep track of the peers and associated infos. More...
 
RWCollection< QuerySetqueries
 
std::unique_ptr< PeerDatapeerData
 
CKey sessionKey
 
EventLoop eventLoop
 Event loop machinery. More...
 
std::unique_ptr< interfaces::HandlerchainNotificationsHandler
 

Friends

struct ::avalanche::AvalancheTest
 

Detailed Description

Definition at line 195 of file processor.h.

Member Typedef Documentation

◆ QuerySet

using avalanche::Processor::QuerySet = boost::multi_index_container< Query, boost::multi_index::indexed_by< boost::multi_index::hashed_unique<boost::multi_index::composite_key< Query, boost::multi_index::member<Query, NodeId, &Query::nodeid>, boost::multi_index::member<Query, uint64_t, &Query::round> >>, boost::multi_index::ordered_non_unique< boost::multi_index::tag<query_timeout>, boost::multi_index::member<Query, TimePoint, &Query::timeout> >> >
private

Definition at line 242 of file processor.h.

Constructor & Destructor Documentation

◆ Processor()

avalanche::Processor::Processor ( interfaces::Chain chain,
CConnman connmanIn,
NodePeerManager nodePeerManagerIn 
)

Definition at line 156 of file processor.cpp.

Here is the call graph for this function:

◆ ~Processor()

avalanche::Processor::~Processor ( )

Definition at line 200 of file processor.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addBlockToReconcile()

bool avalanche::Processor::addBlockToReconcile ( const CBlockIndex pindex)

Definition at line 205 of file processor.cpp.

Here is the call graph for this function:

◆ addNode()

bool avalanche::Processor::addNode ( NodeId  nodeid,
const Proof proof,
const Delegation delegation 
)

Definition at line 384 of file processor.cpp.

◆ clearTimedoutRequests()

void avalanche::Processor::clearTimedoutRequests ( )
private

Definition at line 483 of file processor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ forNode()

bool avalanche::Processor::forNode ( NodeId  nodeid,
std::function< bool(const Node &n)>  func 
) const

Definition at line 390 of file processor.cpp.

◆ getConfidence()

int avalanche::Processor::getConfidence ( const CBlockIndex pindex) const

Definition at line 233 of file processor.cpp.

Here is the call graph for this function:

◆ getInvsForNextPoll()

std::vector< CInv > avalanche::Processor::getInvsForNextPoll ( bool  forPoll = true)
private

Definition at line 439 of file processor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSessionPubKey()

CPubKey avalanche::Processor::getSessionPubKey ( ) const

Definition at line 396 of file processor.cpp.

Here is the call graph for this function:

◆ getSuitableNodeToQuery()

NodeId avalanche::Processor::getSuitableNodeToQuery ( )
private

Definition at line 478 of file processor.cpp.

Here is the caller graph for this function:

◆ GUARDED_BY()

std::unique_ptr<PeerManager> peerManager avalanche::Processor::GUARDED_BY ( cs_peerManager  )
private

◆ isAccepted()

bool avalanche::Processor::isAccepted ( const CBlockIndex pindex) const

Definition at line 223 of file processor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerVotes()

bool avalanche::Processor::registerVotes ( NodeId  nodeid,
const Response response,
std::vector< BlockUpdate > &  updates 
)

Definition at line 279 of file processor.cpp.

Here is the call graph for this function:

◆ runEventLoop()

void avalanche::Processor::runEventLoop ( )
private

If we lost contact to that node, then we remove it from nodeids, but never add the request to queries, which ensures bad nodes get cleaned up over time.

Definition at line 529 of file processor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendHello()

bool avalanche::Processor::sendHello ( CNode pfrom) const

Definition at line 400 of file processor.cpp.

Here is the call graph for this function:

◆ sendResponse()

void avalanche::Processor::sendResponse ( CNode pfrom,
Response  response 
) const

Definition at line 272 of file processor.cpp.

Here is the call graph for this function:

◆ setQueryTimeoutDuration()

void avalanche::Processor::setQueryTimeoutDuration ( std::chrono::milliseconds  d)
inline

Definition at line 263 of file processor.h.

Here is the call graph for this function:

◆ startEventLoop()

bool avalanche::Processor::startEventLoop ( CScheduler scheduler)

Definition at line 430 of file processor.cpp.

Here is the call graph for this function:

◆ stopEventLoop()

bool avalanche::Processor::stopEventLoop ( )

Definition at line 435 of file processor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ::avalanche::AvalancheTest

friend struct ::avalanche::AvalancheTest
friend

Definition at line 292 of file processor.h.

Member Data Documentation

◆ chainNotificationsHandler

std::unique_ptr<interfaces::Handler> avalanche::Processor::chainNotificationsHandler
private

Definition at line 255 of file processor.h.

◆ connman

CConnman* avalanche::Processor::connman
private

Definition at line 196 of file processor.h.

◆ cs_peerManager

Mutex avalanche::Processor::cs_peerManager
mutableprivate

Keep track of the peers and associated infos.

Definition at line 213 of file processor.h.

◆ eventLoop

EventLoop avalanche::Processor::eventLoop
private

Event loop machinery.

Definition at line 252 of file processor.h.

◆ nodePeerManager

NodePeerManager* avalanche::Processor::nodePeerManager
private

Definition at line 197 of file processor.h.

◆ peerData

std::unique_ptr<PeerData> avalanche::Processor::peerData
private

Definition at line 247 of file processor.h.

◆ queries

RWCollection<QuerySet> avalanche::Processor::queries
private

Definition at line 244 of file processor.h.

◆ queryTimeoutDuration

std::chrono::milliseconds avalanche::Processor::queryTimeoutDuration
private

Definition at line 198 of file processor.h.

◆ round

std::atomic<uint64_t> avalanche::Processor::round
private

Keep track of peers and queries sent.

Definition at line 208 of file processor.h.

◆ sessionKey

CKey avalanche::Processor::sessionKey
private

Definition at line 249 of file processor.h.

◆ vote_records

RWCollection<BlockVoteMap> avalanche::Processor::vote_records
private

Blocks to run avalanche on.

Definition at line 203 of file processor.h.


The documentation for this class was generated from the following files: