PIVX Core  5.6.99
P2P Digital Currency
Classes | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
CMasternodeMan Class Reference

#include <masternodeman.h>

Collaboration diagram for CMasternodeMan:
[legend]

Classes

struct  MNsInfo
 

Public Member Functions

 SERIALIZE_METHODS (CMasternodeMan, obj)
 
 CMasternodeMan ()
 
bool Add (CMasternode &mn)
 Add an entry. More...
 
void AskForMN (CNode *pnode, const CTxIn &vin)
 Ask (source) node for mnb. More...
 
int CheckAndRemove (bool forceExpiredRemoval=false)
 Check all Masternodes and remove inactive. Return the total masternode count. More...
 
void Clear ()
 Clear Masternode vector. More...
 
void SetBestHeight (int height)
 
int GetBestHeight () const
 
int CountEnabled (bool only_legacy=false) const
 
bool RequestMnList (CNode *pnode)
 
CMasternodeFind (const COutPoint &collateralOut)
 Find an entry. More...
 
const CMasternodeFind (const COutPoint &collateralOut) const
 
CMasternodeFind (const CPubKey &pubKeyMasternode)
 
void CheckSpentCollaterals (const std::vector< CTransactionRef > &vtx)
 Check all transactions in a block, for spent masternode collateral outpoints (marking them as spent) More...
 
MasternodeRef GetNextMasternodeInQueueForPayment (int nBlockHeight, bool fFilterSigTime, int &nCount, const CBlockIndex *pChainTip=nullptr) const
 Find an entry in the masternode list that is next to be paid. More...
 
MasternodeRef GetCurrentMasterNode (const uint256 &hash) const
 Get the winner for this block hash. More...
 
std::vector< std::pair< MasternodeRef, int > > GetMnScores (int nLast) const
 vector of pairs <masternode winner, height> More...
 
std::vector< std::pair< int64_t, MasternodeRef > > GetMasternodeRanks (int nBlockHeight) const
 
int GetMasternodeRank (const CTxIn &vin, int64_t nBlockHeight) const
 
bool ProcessMessage (CNode *pfrom, std::string &strCommand, CDataStream &vRecv, int &dosScore)
 
int ProcessGetMNList (CNode *pfrom, CTxIn &vin)
 
CMasternodeMan::MNsInfo getMNsInfo () const
 
std::string ToString () const
 
void Remove (const COutPoint &collateralOut)
 
void UpdateMasternodeList (CMasternodeBroadcast &mnb)
 Update masternode list and maps using provided CMasternodeBroadcast. More...
 
int64_t GetLastPaid (const MasternodeRef &mn, int count_enabled, const CBlockIndex *BlockReading) const
 Get the time a masternode was last paid. More...
 
int64_t SecondsSincePayment (const MasternodeRef &mn, int count_enabled, const CBlockIndex *BlockReading) const
 
void CacheBlockHash (const CBlockIndex *pindex)
 
void UncacheBlockHash (const CBlockIndex *pindex)
 
uint256 GetHashAtHeight (int nHeight) const
 
bool IsWithinDepth (const uint256 &nHash, int depth) const
 
uint256 GetBlockHashToPing () const
 
std::vector< uint256GetCachedBlocks () const
 

Public Attributes

std::map< uint256, CMasternodeBroadcastmapSeenMasternodeBroadcast
 
std::map< uint256, CMasternodePingmapSeenMasternodePing
 
int64_t nDsqCount
 

Private Member Functions

int ProcessMNBroadcast (CNode *pfrom, CMasternodeBroadcast &mnb)
 
int ProcessMNPing (CNode *pfrom, CMasternodePing &mnp)
 
int ProcessMessageInner (CNode *pfrom, std::string &strCommand, CDataStream &vRecv)
 
void BroadcastInvMN (CMasternode *mn, CNode *pfrom)
 
bool CheckInputs (CMasternodeBroadcast &mnb, int nChainHeight, int &nDoS)
 

Private Attributes

RecursiveMutex cs
 
RecursiveMutex cs_process_message
 
std::map< COutPoint, MasternodeRefmapMasternodes
 
std::map< CNetAddr, int64_t > mAskedUsForMasternodeList
 
std::map< CNetAddr, int64_t > mWeAskedForMasternodeList
 
std::map< COutPoint, int64_t > mWeAskedForMasternodeListEntry
 
std::atomic< int > nBestHeight
 
CyclingVector< uint256cvLastBlockHashes
 

Detailed Description

Definition at line 56 of file masternodeman.h.

Constructor & Destructor Documentation

◆ CMasternodeMan()

CMasternodeMan::CMasternodeMan ( )

Definition at line 183 of file masternodeman.cpp.

Member Function Documentation

◆ Add()

bool CMasternodeMan::Add ( CMasternode mn)

Add an entry.

Todo:
: remove when transition to DMN is complete

Definition at line 188 of file masternodeman.cpp.

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

◆ AskForMN()

void CMasternodeMan::AskForMN ( CNode pnode,
const CTxIn vin 
)

Ask (source) node for mnb.

Todo:
: remove when transition to DMN is complete

Definition at line 217 of file masternodeman.cpp.

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

◆ BroadcastInvMN()

void CMasternodeMan::BroadcastInvMN ( CMasternode mn,
CNode pfrom 
)
private

Definition at line 888 of file masternodeman.cpp.

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

◆ CacheBlockHash()

void CMasternodeMan::CacheBlockHash ( const CBlockIndex pindex)

Definition at line 1104 of file masternodeman.cpp.

Here is the call graph for this function:

◆ CheckAndRemove()

int CMasternodeMan::CheckAndRemove ( bool  forceExpiredRemoval = false)

Check all Masternodes and remove inactive. Return the total masternode count.

Todo:
: remove when transition to DMN is complete

Definition at line 238 of file masternodeman.cpp.

Here is the call graph for this function:

◆ CheckInputs()

bool CMasternodeMan::CheckInputs ( CMasternodeBroadcast mnb,
int  nChainHeight,
int &  nDoS 
)
private

Definition at line 745 of file masternodeman.cpp.

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

◆ CheckSpentCollaterals()

void CMasternodeMan::CheckSpentCollaterals ( const std::vector< CTransactionRef > &  vtx)

Check all transactions in a block, for spent masternode collateral outpoints (marking them as spent)

Todo:
: remove when transition to DMN is complete

Definition at line 502 of file masternodeman.cpp.

◆ Clear()

void CMasternodeMan::Clear ( )

Clear Masternode vector.

Definition at line 354 of file masternodeman.cpp.

Here is the caller graph for this function:

◆ CountEnabled()

int CMasternodeMan::CountEnabled ( bool  only_legacy = false) const

Definition at line 429 of file masternodeman.cpp.

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

◆ Find() [1/3]

CMasternode * CMasternodeMan::Find ( const COutPoint collateralOut)

Find an entry.

Definition at line 476 of file masternodeman.cpp.

Here is the caller graph for this function:

◆ Find() [2/3]

const CMasternode * CMasternodeMan::Find ( const COutPoint collateralOut) const

Definition at line 483 of file masternodeman.cpp.

◆ Find() [3/3]

CMasternode * CMasternodeMan::Find ( const CPubKey pubKeyMasternode)

Definition at line 490 of file masternodeman.cpp.

◆ GetBestHeight()

int CMasternodeMan::GetBestHeight ( ) const
inline

Definition at line 129 of file masternodeman.h.

Here is the caller graph for this function:

◆ GetBlockHashToPing()

uint256 CMasternodeMan::GetBlockHashToPing ( ) const
inline

Definition at line 194 of file masternodeman.h.

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

◆ GetCachedBlocks()

std::vector<uint256> CMasternodeMan::GetCachedBlocks ( ) const
inline

Definition at line 195 of file masternodeman.h.

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

◆ GetCurrentMasterNode()

MasternodeRef CMasternodeMan::GetCurrentMasterNode ( const uint256 hash) const

Get the winner for this block hash.

Definition at line 612 of file masternodeman.cpp.

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

◆ GetHashAtHeight()

uint256 CMasternodeMan::GetHashAtHeight ( int  nHeight) const

Definition at line 1114 of file masternodeman.cpp.

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

◆ GetLastPaid()

int64_t CMasternodeMan::GetLastPaid ( const MasternodeRef mn,
int  count_enabled,
const CBlockIndex BlockReading 
) const

Get the time a masternode was last paid.

Definition at line 1061 of file masternodeman.cpp.

Here is the caller graph for this function:

◆ GetMasternodeRank()

int CMasternodeMan::GetMasternodeRank ( const CTxIn vin,
int64_t  nBlockHeight 
) const

Definition at line 665 of file masternodeman.cpp.

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

◆ GetMasternodeRanks()

std::vector< std::pair< int64_t, MasternodeRef > > CMasternodeMan::GetMasternodeRanks ( int  nBlockHeight) const

Definition at line 715 of file masternodeman.cpp.

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

◆ GetMnScores()

std::vector< std::pair< MasternodeRef, int > > CMasternodeMan::GetMnScores ( int  nLast) const

vector of pairs <masternode winner, height>

Definition at line 649 of file masternodeman.cpp.

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

◆ getMNsInfo()

CMasternodeMan::MNsInfo CMasternodeMan::getMNsInfo ( ) const

Definition at line 388 of file masternodeman.cpp.

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

◆ GetNextMasternodeInQueueForPayment()

MasternodeRef CMasternodeMan::GetNextMasternodeInQueueForPayment ( int  nBlockHeight,
bool  fFilterSigTime,
int &  nCount,
const CBlockIndex pChainTip = nullptr 
) const

Find an entry in the masternode list that is next to be paid.

Todo:
: remove when transition to DMN is complete

Definition at line 541 of file masternodeman.cpp.

Here is the caller graph for this function:

◆ IsWithinDepth()

bool CMasternodeMan::IsWithinDepth ( const uint256 nHash,
int  depth 
) const

Definition at line 1138 of file masternodeman.cpp.

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

◆ ProcessGetMNList()

int CMasternodeMan::ProcessGetMNList ( CNode pfrom,
CTxIn vin 
)

Definition at line 898 of file masternodeman.cpp.

Here is the call graph for this function:

◆ ProcessMessage()

bool CMasternodeMan::ProcessMessage ( CNode pfrom,
std::string &  strCommand,
CDataStream vRecv,
int &  dosScore 
)

Definition at line 947 of file masternodeman.cpp.

Here is the call graph for this function:

◆ ProcessMessageInner()

int CMasternodeMan::ProcessMessageInner ( CNode pfrom,
std::string &  strCommand,
CDataStream vRecv 
)
private
Todo:
: remove when transition to DMN is complete

Definition at line 953 of file masternodeman.cpp.

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

◆ ProcessMNBroadcast()

int CMasternodeMan::ProcessMNBroadcast ( CNode pfrom,
CMasternodeBroadcast mnb 
)
private

Definition at line 808 of file masternodeman.cpp.

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

◆ ProcessMNPing()

int CMasternodeMan::ProcessMNPing ( CNode pfrom,
CMasternodePing mnp 
)
private

Definition at line 860 of file masternodeman.cpp.

Here is the call graph for this function:

◆ Remove()

void CMasternodeMan::Remove ( const COutPoint collateralOut)

Definition at line 1015 of file masternodeman.cpp.

Here is the caller graph for this function:

◆ RequestMnList()

bool CMasternodeMan::RequestMnList ( CNode pnode)
Todo:
: remove when transition to DMN is complete

Definition at line 450 of file masternodeman.cpp.

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

◆ SecondsSincePayment()

int64_t CMasternodeMan::SecondsSincePayment ( const MasternodeRef mn,
int  count_enabled,
const CBlockIndex BlockReading 
) const

Definition at line 1046 of file masternodeman.cpp.

Here is the call graph for this function:

◆ SERIALIZE_METHODS()

CMasternodeMan::SERIALIZE_METHODS ( CMasternodeMan  ,
obj   
)
inline

Definition at line 101 of file masternodeman.h.

◆ SetBestHeight()

void CMasternodeMan::SetBestHeight ( int  height)
inline

Definition at line 128 of file masternodeman.h.

Here is the caller graph for this function:

◆ ToString()

std::string CMasternodeMan::ToString ( ) const

Definition at line 1094 of file masternodeman.cpp.

◆ UncacheBlockHash()

void CMasternodeMan::UncacheBlockHash ( const CBlockIndex pindex)

Definition at line 1109 of file masternodeman.cpp.

Here is the call graph for this function:

◆ UpdateMasternodeList()

void CMasternodeMan::UpdateMasternodeList ( CMasternodeBroadcast mnb)

Update masternode list and maps using provided CMasternodeBroadcast.

Todo:
: remove when transition to DMN is complete

Definition at line 1024 of file masternodeman.cpp.

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

Member Data Documentation

◆ cs

RecursiveMutex CMasternodeMan::cs
mutableprivate

Definition at line 60 of file masternodeman.h.

◆ cs_process_message

RecursiveMutex CMasternodeMan::cs_process_message
mutableprivate

Definition at line 63 of file masternodeman.h.

◆ cvLastBlockHashes

CyclingVector<uint256> CMasternodeMan::cvLastBlockHashes
private

Definition at line 78 of file masternodeman.h.

◆ mapMasternodes

std::map<COutPoint, MasternodeRef> CMasternodeMan::mapMasternodes
private

Definition at line 66 of file masternodeman.h.

◆ mapSeenMasternodeBroadcast

std::map<uint256, CMasternodeBroadcast> CMasternodeMan::mapSeenMasternodeBroadcast

Definition at line 93 of file masternodeman.h.

◆ mapSeenMasternodePing

std::map<uint256, CMasternodePing> CMasternodeMan::mapSeenMasternodePing

Definition at line 95 of file masternodeman.h.

◆ mAskedUsForMasternodeList

std::map<CNetAddr, int64_t> CMasternodeMan::mAskedUsForMasternodeList
private

Definition at line 68 of file masternodeman.h.

◆ mWeAskedForMasternodeList

std::map<CNetAddr, int64_t> CMasternodeMan::mWeAskedForMasternodeList
private

Definition at line 70 of file masternodeman.h.

◆ mWeAskedForMasternodeListEntry

std::map<COutPoint, int64_t> CMasternodeMan::mWeAskedForMasternodeListEntry
private

Definition at line 72 of file masternodeman.h.

◆ nBestHeight

std::atomic<int> CMasternodeMan::nBestHeight
private

Definition at line 75 of file masternodeman.h.

◆ nDsqCount

int64_t CMasternodeMan::nDsqCount
Todo:
: Remove this from serialization

Definition at line 99 of file masternodeman.h.


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