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

#include <processor.h>

Inheritance diagram for avalanche::Processor:
[legend]
Collaboration diagram for avalanche::Processor:
[legend]

Classes

struct  GetLocalAcceptance
 
struct  IsWorthPolling
 
class  NotificationsHandler
 
struct  PeerData
 
struct  Query
 
struct  StakingReward
 

Public Member Functions

 ~Processor ()
 
bool addToReconcile (const AnyVoteItem &item) EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
 
bool reconcileOrFinalize (const ProofRef &proof) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 Wrapper around the addToReconcile for proofs that adds back the finalization flag to the peer if it is not polled due to being recently finalized. More...
 
bool isAccepted (const AnyVoteItem &item) const
 
int getConfidence (const AnyVoteItem &item) const
 
bool isPolled (const AnyVoteItem &item) const
 
bool isRecentlyFinalized (const uint256 &itemId) const EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
 
void setRecentlyFinalized (const uint256 &itemId) EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
 
void clearFinalizedItems () EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
 
void sendResponse (CNode *pfrom, Response response) const
 
bool registerVotes (NodeId nodeid, const Response &response, std::vector< VoteItemUpdate > &updates, bool &disconnect, std::string &error) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 
template<typename Callable >
auto withPeerManager (Callable &&func) const EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
 
CPubKey getSessionPubKey () const
 
bool sendHello (CNode *pfrom) EXCLUSIVE_LOCKS_REQUIRED(!cs_delayedAvahelloNodeIds)
 Send a avahello message. More...
 
void sendDelayedAvahello () EXCLUSIVE_LOCKS_REQUIRED(!cs_delayedAvahelloNodeIds)
 
ProofRef getLocalProof () const
 
ProofRegistrationState getLocalProofRegistrationState () const EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
 
bool isAvalancheServiceAvailable ()
 
bool hasFinalizedTip () const EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizationTip)
 Whether there is a finalized tip. More...
 
bool startEventLoop (CScheduler &scheduler)
 
bool stopEventLoop ()
 
void avaproofsSent (NodeId nodeid) LOCKS_EXCLUDED(cs_main) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
 
int64_t getAvaproofsNodeCounter () const
 
bool isQuorumEstablished () LOCKS_EXCLUDED(cs_main) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 
bool canShareLocalProof ()
 
bool computeStakingReward (const CBlockIndex *pindex) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 
bool eraseStakingRewardWinner (const BlockHash &prevBlockHash) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards)
 
void cleanupStakingRewards (const int minHeight) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards
 
bool getStakingRewardWinners (const BlockHash &prevBlockHash, std::vector< std::pair< ProofId, CScript > > &winners) const EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards)
 
bool getStakingRewardWinners (const BlockHash &prevBlockHash, std::vector< CScript > &payouts) const EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards)
 
bool setStakingRewardWinners (const CBlockIndex *pprev, const std::vector< CScript > &payouts) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards
 
bool setStakingRewardWinners (const CBlockIndex *pprev, const std::vector< std::pair< ProofId, CScript > > &winners) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards)
 
void InitializeNode (const ::Config &config, CNode &pnode, ServiceFlags our_services) override
 
bool ProcessMessages (const ::Config &config, CNode *pnode, std::atomic< bool > &interrupt) override
 
bool SendMessages (const ::Config &config, CNode *pnode) override
 
void FinalizeNode (const ::Config &config, const CNode &node) override LOCKS_EXCLUDED(cs_main) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 Handle removal of a node. More...
 
int getStakeContenderStatus (const StakeContenderId &contenderId) const EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 Track votes on stake contenders. More...
 
void acceptStakeContender (const StakeContenderId &contenderId) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
 
void finalizeStakeContender (const StakeContenderId &contenderId) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 
void rejectStakeContender (const StakeContenderId &contenderId) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 
void promoteAndPollStakeContenders (const CBlockIndex *pprev) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards
 Promote stake contender cache entries to a given block and then poll. More...
 
bool isPreconsensusActivated (const CBlockIndex *pprev) const EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizationTip)
 
bool isStakingPreconsensusActivated (const CBlockIndex *pprev) const
 
size_t getMaxElementPoll () const
 
- Public Member Functions inherited from NetEventsInterface
virtual void InitializeNode (const Config &config, CNode &node, ServiceFlags our_services)=0
 Initialize a peer (setup state, queue any initial messages) More...
 
virtual void FinalizeNode (const Config &config, const CNode &node)=0
 Handle removal of a peer (clear state) More...
 
virtual bool ProcessMessages (const Config &config, CNode *pnode, std::atomic< bool > &interrupt) EXCLUSIVE_LOCKS_REQUIRED(g_msgproc_mutex)=0
 Process protocol messages received from a given node. More...
 
virtual bool SendMessages (const Config &config, CNode *pnode) EXCLUSIVE_LOCKS_REQUIRED(g_msgproc_mutex)=0
 Send queued protocol messages to a given node. More...
 

Static Public Member Functions

static std::unique_ptr< Processor > MakeProcessor (const ArgsManager &argsman, interfaces::Chain &chain, CConnman *connman, ChainstateManager &chainman, CTxMemPool *mempoolIn, CScheduler &scheduler, bilingual_str &error)
 

Public Attributes

bool !cs_finalizedItems
 
bool !cs_invalidatedBlocks
 
bool !cs_finalizationTip
 
bool !cs_stakingRewards
 
void !cs_peerManager
 
bool !cs_peerManager
 
void !cs_delayedAvahelloNodeIds
 
int !cs_stakingRewards
 
void !cs_stakingRewards
 
void !cs_finalizedItems
 

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, SteadyMilliseconds, &Query::timeout > > > >
 

Private Member Functions

std::unique_ptr< PeerManager > peerManager GUARDED_BY (cs_peerManager)
 
const CBlockIndex *finalizationTip GUARDED_BY (cs_finalizationTip)
 
std::unordered_set< NodeId > delayedAvahelloNodeIds GUARDED_BY (cs_delayedAvahelloNodeIds)
 A list of the nodes that did not get our proof announced via avahello yet because we had no inbound connection. More...
 
std::unordered_map< BlockHash, StakingReward, SaltedUint256Hasher > stakingRewards GUARDED_BY (cs_stakingRewards)
 
 Processor (Config avaconfig, interfaces::Chain &chain, CConnman *connmanIn, ChainstateManager &chainman, CTxMemPool *mempoolIn, CScheduler &scheduler, std::unique_ptr< PeerData > peerDataIn, CKey sessionKeyIn, uint32_t minQuorumTotalScoreIn, double minQuorumConnectedScoreRatioIn, int64_t minAvaproofsNodeCountIn, uint32_t staleVoteThresholdIn, uint32_t staleVoteFactorIn, Amount stakeUtxoDustThresholdIn, bool preConsensus, bool stakingPreConsensus, size_t maxElementPoll)
 
void updatedBlockTip () EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 
void transactionAddedToMempool (const CTransactionRef &tx) EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems
 
void runEventLoop () EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 
void clearInvsNotWorthPolling () EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 
void clearTimedoutRequests () EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
 
void clearInflightRequests (const std::vector< CInv > &invs) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
 Decrement VoteRecord::inflight for each inventory. More...
 
void clearInflightRequests (const std::map< CInv, uint8_t > &inflightRequests) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
 Decrement VoteRecord::inflight for each inventory by the given count. More...
 
std::vector< CInv > getInvsForNextPoll (RWCollection< VoteMap >::ReadView &voteRecordsReadView, size_t max_elements, bool forPoll=true) const
 
bool sendHelloInternal (CNode *pfrom) EXCLUSIVE_LOCKS_REQUIRED(cs_delayedAvahelloNodeIds)
 
AnyVoteItem getVoteItemFromInv (const CInv &inv) const EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
 
bool setContenderStatusForLocalWinners (const CBlockIndex *pindex, std::vector< StakeContenderId > &pollableContenders) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
 Helper to set the vote status for local winners in the contender cache. More...
 
CRollingBloomFilter invalidatedBlocks GUARDED_BY (cs_invalidatedBlocks)
 
CRollingBloomFilter finalizedItems GUARDED_BY (cs_finalizedItems)
 
bool isWorthPolling (const AnyVoteItem &item) const EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
 
bool getLocalAcceptance (const AnyVoteItem &item) const
 

Private Attributes

Config avaconfig
 
CConnman * connman
 
ChainstateManager & chainman
 
CTxMemPool * mempool
 
RWCollection< VoteMap > voteRecords
 Items 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< QuerySet > queries
 
std::unique_ptr< PeerData > peerData
 
CKey sessionKey
 
EventLoop eventLoop
 Event loop machinery. More...
 
uint32_t minQuorumScore
 Quorum management. More...
 
double minQuorumConnectedScoreRatio
 
std::atomic< bool > quorumIsEstablished {false}
 
std::atomic< bool > m_canShareLocalProof {false}
 
int64_t minAvaproofsNodeCount
 
std::atomic< int64_t > avaproofsNodeCounter {0}
 
const uint32_t staleVoteThreshold
 Voting parameters. More...
 
const uint32_t staleVoteFactor
 
std::unique_ptr< interfaces::Handler > chainNotificationsHandler
 
Mutex cs_finalizationTip
 
Mutex cs_delayedAvahelloNodeIds
 
Mutex cs_stakingRewards
 
const bool m_preConsensus {false}
 
std::atomic_bool m_stakingPreConsensus {false}
 
std::optional< uint32_t > m_voteRecordSeed
 
const size_t m_maxElementPoll {DEFAULT_AVALANCHE_MAX_ELEMENT_POLL}
 
void !cs_finalizationTip
 
Mutex cs_invalidatedBlocks
 We don't need many blocks but a low false positive rate. More...
 
Mutex cs_finalizedItems
 Rolling bloom filter to track recently finalized inventory items of any type. More...
 

Friends

struct ::avalanche::AvalancheTest
 

Additional Inherited Members

- Static Public Attributes inherited from NetEventsInterface
static Mutex g_msgproc_mutex
 Mutex for anything that is only accessed via the msg processing thread. More...
 
- Protected Member Functions inherited from NetEventsInterface
 ~NetEventsInterface ()=default
 Protected destructor so that instances can only be deleted by derived classes. More...
 

Detailed Description

Definition at line 169 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, SteadyMilliseconds, &Query::timeout> >> >
private

Definition at line 205 of file processor.h.

Constructor & Destructor Documentation

◆ Processor()

avalanche::Processor::Processor ( Config  avaconfig,
interfaces::Chain &  chain,
CConnman *  connmanIn,
ChainstateManager &  chainman,
CTxMemPool *  mempoolIn,
CScheduler &  scheduler,
std::unique_ptr< PeerData >  peerDataIn,
CKey  sessionKeyIn,
uint32_t  minQuorumTotalScoreIn,
double  minQuorumConnectedScoreRatioIn,
int64_t  minAvaproofsNodeCountIn,
uint32_t  staleVoteThresholdIn,
uint32_t  staleVoteFactorIn,
Amount  stakeUtxoDustThresholdIn,
bool  preConsensus,
bool  stakingPreConsensus,
size_t  maxElementPoll 
)
private

Definition at line 147 of file processor.cpp.

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

◆ ~Processor()

avalanche::Processor::~Processor ( )

Definition at line 211 of file processor.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ acceptStakeContender()

void avalanche::Processor::acceptStakeContender ( const StakeContenderId &  contenderId)

Definition at line 1106 of file processor.cpp.

◆ addToReconcile()

bool avalanche::Processor::addToReconcile ( const AnyVoteItem &  item)

Definition at line 443 of file processor.cpp.

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

◆ avaproofsSent()

void avalanche::Processor::avaproofsSent ( NodeId  nodeid)

Definition at line 822 of file processor.cpp.

Here is the call graph for this function:

◆ canShareLocalProof()

bool avalanche::Processor::canShareLocalProof ( )

Definition at line 929 of file processor.cpp.

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

◆ cleanupStakingRewards()

void avalanche::Processor::cleanupStakingRewards ( const int  minHeight)

Definition at line 988 of file processor.cpp.

◆ clearFinalizedItems()

void avalanche::Processor::clearFinalizedItems ( )

Definition at line 528 of file processor.cpp.

◆ clearInflightRequests() [1/2]

void avalanche::Processor::clearInflightRequests ( const std::map< CInv, uint8_t > &  inflightRequests)
private

Decrement VoteRecord::inflight for each inventory by the given count.

Definition at line 1439 of file processor.cpp.

Here is the call graph for this function:

◆ clearInflightRequests() [2/2]

void avalanche::Processor::clearInflightRequests ( const std::vector< CInv > &  invs)
private

Decrement VoteRecord::inflight for each inventory.

Duplicate invs in the vector are aggregated before clearing.

Definition at line 1431 of file processor.cpp.

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

◆ clearInvsNotWorthPolling()

void avalanche::Processor::clearInvsNotWorthPolling ( )
private

Definition at line 1400 of file processor.cpp.

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

◆ clearTimedoutRequests()

void avalanche::Processor::clearTimedoutRequests ( )
private

Definition at line 1411 of file processor.cpp.

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

◆ computeStakingReward()

bool avalanche::Processor::computeStakingReward ( const CBlockIndex *  pindex)

Definition at line 943 of file processor.cpp.

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

◆ eraseStakingRewardWinner()

bool avalanche::Processor::eraseStakingRewardWinner ( const BlockHash &  prevBlockHash)

Definition at line 983 of file processor.cpp.

◆ FinalizeNode()

void avalanche::Processor::FinalizeNode ( const ::Config &  config,
const CNode &  node 
)
override

Handle removal of a node.

Definition at line 1075 of file processor.cpp.

◆ finalizeStakeContender()

void avalanche::Processor::finalizeStakeContender ( const StakeContenderId &  contenderId)

Definition at line 1111 of file processor.cpp.

Here is the call graph for this function:

◆ getAvaproofsNodeCounter()

int64_t avalanche::Processor::getAvaproofsNodeCounter ( ) const
inline

Definition at line 361 of file processor.h.

◆ getConfidence()

int avalanche::Processor::getConfidence ( const AnyVoteItem &  item) const

Definition at line 496 of file processor.cpp.

Here is the call graph for this function:

◆ getInvsForNextPoll()

std::vector< CInv > avalanche::Processor::getInvsForNextPoll ( RWCollection< VoteMap >::ReadView &  voteRecordsReadView,
size_t  max_elements,
bool  forPoll = true 
) const
private

Definition at line 1462 of file processor.cpp.

Here is the caller graph for this function:

◆ getLocalAcceptance()

bool avalanche::Processor::getLocalAcceptance ( const AnyVoteItem &  item) const
inlineprivate

Definition at line 521 of file processor.h.

Here is the caller graph for this function:

◆ getLocalProof()

ProofRef avalanche::Processor::getLocalProof ( ) const

Definition at line 778 of file processor.cpp.

Here is the caller graph for this function:

◆ getLocalProofRegistrationState()

ProofRegistrationState avalanche::Processor::getLocalProofRegistrationState ( ) const

Definition at line 782 of file processor.cpp.

Here is the call graph for this function:

◆ getMaxElementPoll()

size_t avalanche::Processor::getMaxElementPoll ( ) const
inline

Definition at line 426 of file processor.h.

◆ getSessionPubKey()

CPubKey avalanche::Processor::getSessionPubKey ( ) const

Definition at line 717 of file processor.cpp.

Here is the call graph for this function:

◆ getStakeContenderStatus()

int avalanche::Processor::getStakeContenderStatus ( const StakeContenderId &  contenderId) const

Track votes on stake contenders.

Definition at line 1083 of file processor.cpp.

Here is the call graph for this function:

◆ getStakingRewardWinners() [1/2]

bool avalanche::Processor::getStakingRewardWinners ( const BlockHash &  prevBlockHash,
std::vector< CScript > &  payouts 
) const

Definition at line 1023 of file processor.cpp.

Here is the call graph for this function:

◆ getStakingRewardWinners() [2/2]

bool avalanche::Processor::getStakingRewardWinners ( const BlockHash &  prevBlockHash,
std::vector< std::pair< ProofId, CScript > > &  winners 
) const

Definition at line 1010 of file processor.cpp.

Here is the caller graph for this function:

◆ getVoteItemFromInv()

AnyVoteItem avalanche::Processor::getVoteItemFromInv ( const CInv &  inv) const
private

Definition at line 1500 of file processor.cpp.

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

◆ GUARDED_BY() [1/6]

std::unordered_set< NodeId > delayedAvahelloNodeIds avalanche::Processor::GUARDED_BY ( cs_delayedAvahelloNodeIds  )
private

A list of the nodes that did not get our proof announced via avahello yet because we had no inbound connection.

◆ GUARDED_BY() [2/6]

const CBlockIndex *finalizationTip avalanche::Processor::GUARDED_BY ( cs_finalizationTip  )
inlineprivate

Definition at line 248 of file processor.h.

◆ GUARDED_BY() [3/6]

CRollingBloomFilter finalizedItems avalanche::Processor::GUARDED_BY ( cs_finalizedItems  )
inlineprivate

Definition at line 489 of file processor.h.

◆ GUARDED_BY() [4/6]

CRollingBloomFilter invalidatedBlocks avalanche::Processor::GUARDED_BY ( cs_invalidatedBlocks  )
inlineprivate

Definition at line 476 of file processor.h.

◆ GUARDED_BY() [5/6]

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

◆ GUARDED_BY() [6/6]

std::unordered_map< BlockHash, StakingReward, SaltedUint256Hasher > stakingRewards avalanche::Processor::GUARDED_BY ( cs_stakingRewards  )
private

◆ hasFinalizedTip()

bool avalanche::Processor::hasFinalizedTip ( ) const
inline

Whether there is a finalized tip.

Definition at line 351 of file processor.h.

Here is the caller graph for this function:

◆ InitializeNode()

void avalanche::Processor::InitializeNode ( const ::Config &  config,
CNode &  pnode,
ServiceFlags  our_services 
)
inlineoverride

Definition at line 392 of file processor.h.

◆ isAccepted()

bool avalanche::Processor::isAccepted ( const AnyVoteItem &  item) const

Definition at line 482 of file processor.cpp.

Here is the call graph for this function:

◆ isAvalancheServiceAvailable()

bool avalanche::Processor::isAvalancheServiceAvailable ( )
inline

Definition at line 348 of file processor.h.

◆ isPolled()

bool avalanche::Processor::isPolled ( const AnyVoteItem &  item) const

Definition at line 510 of file processor.cpp.

Here is the call graph for this function:

◆ isPreconsensusActivated()

bool avalanche::Processor::isPreconsensusActivated ( const CBlockIndex *  pprev) const

Definition at line 1634 of file processor.cpp.

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

◆ isQuorumEstablished()

bool avalanche::Processor::isQuorumEstablished ( )

Definition at line 843 of file processor.cpp.

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

◆ isRecentlyFinalized()

bool avalanche::Processor::isRecentlyFinalized ( const uint256 &  itemId) const

Definition at line 520 of file processor.cpp.

Here is the caller graph for this function:

◆ isStakingPreconsensusActivated()

bool avalanche::Processor::isStakingPreconsensusActivated ( const CBlockIndex *  pprev) const

Definition at line 1640 of file processor.cpp.

Here is the caller graph for this function:

◆ isWorthPolling()

bool avalanche::Processor::isWorthPolling ( const AnyVoteItem &  item) const
private

Definition at line 1593 of file processor.cpp.

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

◆ MakeProcessor()

std::unique_ptr< Processor > avalanche::Processor::MakeProcessor ( const ArgsManager &  argsman,
interfaces::Chain &  chain,
CConnman *  connman,
ChainstateManager &  chainman,
CTxMemPool *  mempoolIn,
CScheduler &  scheduler,
bilingual_str &  error 
)
static

Definition at line 226 of file processor.cpp.

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

◆ ProcessMessages()

bool avalanche::Processor::ProcessMessages ( const ::Config &  config,
CNode *  pnode,
std::atomic< bool > &  interrupt 
)
inlineoverride

Definition at line 394 of file processor.h.

◆ promoteAndPollStakeContenders()

void avalanche::Processor::promoteAndPollStakeContenders ( const CBlockIndex *  pprev)

Promote stake contender cache entries to a given block and then poll.

Definition at line 1206 of file processor.cpp.

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

◆ reconcileOrFinalize()

bool avalanche::Processor::reconcileOrFinalize ( const ProofRef &  proof)

Wrapper around the addToReconcile for proofs that adds back the finalization flag to the peer if it is not polled due to being recently finalized.

Definition at line 463 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< VoteItemUpdate > &  updates,
bool &  disconnect,
std::string &  error 
)

Definition at line 568 of file processor.cpp.

Here is the call graph for this function:

◆ rejectStakeContender()

void avalanche::Processor::rejectStakeContender ( const StakeContenderId &  contenderId)

Definition at line 1133 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. Keep a copy of invs for inflight rollback if the send fails (registerPoll already ran during gather).

Definition at line 1303 of file processor.cpp.

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

◆ sendDelayedAvahello()

void avalanche::Processor::sendDelayedAvahello ( )

Definition at line 761 of file processor.cpp.

Here is the call graph for this function:

◆ sendHello()

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

Send a avahello message.

Parameters
pfromThe node to send the message to
Returns
True if a non-null delegation has been announced

Definition at line 756 of file processor.cpp.

Here is the call graph for this function:

◆ sendHelloInternal()

bool avalanche::Processor::sendHelloInternal ( CNode *  pfrom)
private

Definition at line 721 of file processor.cpp.

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

◆ SendMessages()

bool avalanche::Processor::SendMessages ( const ::Config &  config,
CNode *  pnode 
)
inlineoverride

Definition at line 398 of file processor.h.

◆ sendResponse()

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

Definition at line 562 of file processor.cpp.

Here is the call graph for this function:

◆ setContenderStatusForLocalWinners()

bool avalanche::Processor::setContenderStatusForLocalWinners ( const CBlockIndex *  pindex,
std::vector< StakeContenderId > &  pollableContenders 
)
private

Helper to set the vote status for local winners in the contender cache.

pollableContenders are the highest ranking contenders that we should poll.

Definition at line 1230 of file processor.cpp.

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

◆ setRecentlyFinalized()

void avalanche::Processor::setRecentlyFinalized ( const uint256 &  itemId)

Definition at line 524 of file processor.cpp.

◆ setStakingRewardWinners() [1/2]

bool avalanche::Processor::setStakingRewardWinners ( const CBlockIndex *  pprev,
const std::vector< CScript > &  payouts 
)

Definition at line 1039 of file processor.cpp.

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

◆ setStakingRewardWinners() [2/2]

bool avalanche::Processor::setStakingRewardWinners ( const CBlockIndex *  pprev,
const std::vector< std::pair< ProofId, CScript > > &  winners 
)

Definition at line 1061 of file processor.cpp.

Here is the call graph for this function:

◆ startEventLoop()

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

Definition at line 813 of file processor.cpp.

Here is the call graph for this function:

◆ stopEventLoop()

bool avalanche::Processor::stopEventLoop ( )

Definition at line 818 of file processor.cpp.

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

◆ transactionAddedToMempool()

void avalanche::Processor::transactionAddedToMempool ( const CTransactionRef &  tx)
private

Definition at line 1296 of file processor.cpp.

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

◆ updatedBlockTip()

void avalanche::Processor::updatedBlockTip ( )
private

Definition at line 1242 of file processor.cpp.

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

◆ withPeerManager()

template<typename Callable >
auto avalanche::Processor::withPeerManager ( Callable &&  func) const
inline

Definition at line 323 of file processor.h.

Friends And Related Function Documentation

◆ ::avalanche::AvalancheTest

friend struct ::avalanche::AvalancheTest
friend

Definition at line 525 of file processor.h.

Member Data Documentation

◆ !cs_delayedAvahelloNodeIds

void avalanche::Processor::!cs_delayedAvahelloNodeIds

Definition at line 405 of file processor.h.

◆ !cs_finalizationTip [1/2]

void avalanche::Processor::!cs_finalizationTip

Definition at line 320 of file processor.h.

◆ !cs_finalizationTip [2/2]

void avalanche::Processor::!cs_finalizationTip
private

Definition at line 431 of file processor.h.

◆ !cs_finalizedItems [1/2]

void avalanche::Processor::!cs_finalizedItems

Definition at line 303 of file processor.h.

◆ !cs_finalizedItems [2/2]

void avalanche::Processor::!cs_finalizedItems

Definition at line 420 of file processor.h.

◆ !cs_invalidatedBlocks

bool avalanche::Processor::!cs_invalidatedBlocks

Definition at line 320 of file processor.h.

◆ !cs_peerManager [1/2]

void avalanche::Processor::!cs_peerManager

Definition at line 375 of file processor.h.

◆ !cs_peerManager [2/2]

bool avalanche::Processor::!cs_peerManager

Definition at line 385 of file processor.h.

◆ !cs_stakingRewards [1/3]

bool avalanche::Processor::!cs_stakingRewards

Definition at line 365 of file processor.h.

◆ !cs_stakingRewards [2/3]

int avalanche::Processor::!cs_stakingRewards

Definition at line 409 of file processor.h.

◆ !cs_stakingRewards [3/3]

void avalanche::Processor::!cs_stakingRewards

Definition at line 413 of file processor.h.

◆ avaconfig

Config avalanche::Processor::avaconfig
private

Definition at line 170 of file processor.h.

◆ avaproofsNodeCounter

std::atomic<int64_t> avalanche::Processor::avaproofsNodeCounter {0}
private

Definition at line 237 of file processor.h.

◆ chainman

ChainstateManager& avalanche::Processor::chainman
private

Definition at line 172 of file processor.h.

◆ chainNotificationsHandler

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

Definition at line 245 of file processor.h.

◆ connman

CConnman* avalanche::Processor::connman
private

Definition at line 171 of file processor.h.

◆ cs_delayedAvahelloNodeIds

Mutex avalanche::Processor::cs_delayedAvahelloNodeIds
mutableprivate

Definition at line 250 of file processor.h.

◆ cs_finalizationTip

Mutex avalanche::Processor::cs_finalizationTip
mutableprivate

Definition at line 247 of file processor.h.

◆ cs_finalizedItems

Mutex avalanche::Processor::cs_finalizedItems
mutableprivate

Rolling bloom filter to track recently finalized inventory items of any type.

Once placed in this filter, those items will not be polled again unless they roll out. Note that this one filter tracks all types so blocks may be rolled out by transaction activity for example.

We want a low false positive rate to prevent accidentally not polling for an item when it is first seen.

Definition at line 488 of file processor.h.

◆ cs_invalidatedBlocks

Mutex avalanche::Processor::cs_invalidatedBlocks
mutableprivate

We don't need many blocks but a low false positive rate.

In the event of a false positive the node might skip polling this block. Such a block will not get marked as finalized until it is reconsidered for polling (if the filter changed its state) or another block is found.

Definition at line 475 of file processor.h.

◆ cs_peerManager

Mutex avalanche::Processor::cs_peerManager
mutableprivate

Keep track of the peers and associated infos.

Definition at line 188 of file processor.h.

◆ cs_stakingRewards

Mutex avalanche::Processor::cs_stakingRewards
mutableprivate

Definition at line 264 of file processor.h.

◆ eventLoop

EventLoop avalanche::Processor::eventLoop
private

Event loop machinery.

Definition at line 227 of file processor.h.

◆ m_canShareLocalProof

std::atomic<bool> avalanche::Processor::m_canShareLocalProof {false}
private

Definition at line 235 of file processor.h.

◆ m_maxElementPoll

const size_t avalanche::Processor::m_maxElementPoll {DEFAULT_AVALANCHE_MAX_ELEMENT_POLL}
private

Definition at line 284 of file processor.h.

◆ m_preConsensus

const bool avalanche::Processor::m_preConsensus {false}
private

Definition at line 278 of file processor.h.

◆ m_stakingPreConsensus

std::atomic_bool avalanche::Processor::m_stakingPreConsensus {false}
private

Definition at line 280 of file processor.h.

◆ m_voteRecordSeed

std::optional<uint32_t> avalanche::Processor::m_voteRecordSeed
private

Definition at line 282 of file processor.h.

◆ mempool

CTxMemPool* avalanche::Processor::mempool
private

Definition at line 173 of file processor.h.

◆ minAvaproofsNodeCount

int64_t avalanche::Processor::minAvaproofsNodeCount
private

Definition at line 236 of file processor.h.

◆ minQuorumConnectedScoreRatio

double avalanche::Processor::minQuorumConnectedScoreRatio
private

Definition at line 233 of file processor.h.

◆ minQuorumScore

uint32_t avalanche::Processor::minQuorumScore
private

Quorum management.

Definition at line 232 of file processor.h.

◆ peerData

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

Definition at line 223 of file processor.h.

◆ queries

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

Definition at line 219 of file processor.h.

◆ quorumIsEstablished

std::atomic<bool> avalanche::Processor::quorumIsEstablished {false}
private

Definition at line 234 of file processor.h.

◆ round

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

Keep track of peers and queries sent.

Definition at line 183 of file processor.h.

◆ sessionKey

CKey avalanche::Processor::sessionKey
private

Definition at line 224 of file processor.h.

◆ staleVoteFactor

const uint32_t avalanche::Processor::staleVoteFactor
private

Definition at line 241 of file processor.h.

◆ staleVoteThreshold

const uint32_t avalanche::Processor::staleVoteThreshold
private

Voting parameters.

Definition at line 240 of file processor.h.

◆ voteRecords

RWCollection<VoteMap> avalanche::Processor::voteRecords
private

Items to run avalanche on.

Definition at line 178 of file processor.h.


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