PIVX Core  5.6.99
P2P Digital Currency
Public Types | Public Member Functions | Public Attributes | Private Attributes | Friends | List of all members
CMasternode Class Reference

#include <masternode.h>

Inheritance diagram for CMasternode:
[legend]
Collaboration diagram for CMasternode:
[legend]

Public Types

enum  state {
  MASTERNODE_PRE_ENABLED , MASTERNODE_ENABLED , MASTERNODE_EXPIRED , MASTERNODE_REMOVE ,
  MASTERNODE_VIN_SPENT
}
 

Public Member Functions

 CMasternode ()
 
 CMasternode (const CMasternode &other)
 
 CMasternode (const CDeterministicMNCPtr &dmn, int64_t registeredTime, const uint256 &registeredHash)
 
uint256 GetSignatureHash () const override
 
std::string GetStrMessage () const override
 
const CTxIn GetVin () const
 
CPubKey GetPubKey () const
 
void SetLastPing (const CMasternodePing &_lastPing)
 
CMasternodeoperator= (const CMasternode &other)
 
arith_uint256 CalculateScore (const uint256 &hash) const
 
 SERIALIZE_METHODS (CMasternode, obj)
 
template<typename Stream >
 CMasternode (deserialize_type, Stream &s)
 
bool UpdateFromNewBroadcast (CMasternodeBroadcast &mnb)
 
CMasternode::state GetActiveState () const
 
bool IsBroadcastedWithin (int seconds)
 
bool IsPingedWithin (int seconds, int64_t now=-1) const
 
void SetSpent ()
 
void Disable ()
 
bool IsEnabled () const
 
bool IsPreEnabled () const
 
bool IsAvailableState () const
 
std::string Status () const
 
bool IsValidNetAddr () const
 
CScript GetPayeeScript () const
 
- Public Member Functions inherited from CSignedMessage
 CSignedMessage ()
 
virtual ~CSignedMessage ()
 
bool Sign (const CKey &key, const CKeyID &keyID)
 CSignedMessage Class Functions inherited by network signed-messages. More...
 
bool Sign (const std::string strSignKey)
 
bool CheckSignature (const CKeyID &keyID) const
 
void SetVchSig (const std::vector< unsigned char > &vchSigIn)
 
std::vector< unsigned char > GetVchSig () const
 
std::string GetSignatureBase64 () const
 
bool Sign (const CBLSSecretKey &sk)
 
bool CheckSignature (const CBLSPublicKey &pk) const
 

Public Attributes

CTxIn vin
 
CService addr
 
CPubKey pubKeyCollateralAddress
 
CPubKey pubKeyMasternode
 
int64_t sigTime
 
int protocolVersion
 
int nScanningErrorCount
 
int nLastScanningErrorBlockHeight
 
CMasternodePing lastPing
 
CScript mnPayeeScript {}
 
- Public Attributes inherited from CSignedMessage
int nMessVersion
 

Private Attributes

RecursiveMutex cs
 
bool fCollateralSpent {false}
 

Friends

bool operator== (const CMasternode &a, const CMasternode &b)
 
bool operator!= (const CMasternode &a, const CMasternode &b)
 

Additional Inherited Members

- Protected Attributes inherited from CSignedMessage
std::vector< unsigned char > vchSig
 

Detailed Description

Definition at line 80 of file masternode.h.

Member Enumeration Documentation

◆ state

Enumerator
MASTERNODE_PRE_ENABLED 
MASTERNODE_ENABLED 
MASTERNODE_EXPIRED 
MASTERNODE_REMOVE 
MASTERNODE_VIN_SPENT 

Definition at line 88 of file masternode.h.

Constructor & Destructor Documentation

◆ CMasternode() [1/4]

CMasternode::CMasternode ( )
explicit

Definition at line 60 of file masternode.cpp.

◆ CMasternode() [2/4]

CMasternode::CMasternode ( const CMasternode other)

Definition at line 76 of file masternode.cpp.

◆ CMasternode() [3/4]

CMasternode::CMasternode ( const CDeterministicMNCPtr dmn,
int64_t  registeredTime,
const uint256 registeredHash 
)

Definition at line 92 of file masternode.cpp.

◆ CMasternode() [4/4]

template<typename Stream >
CMasternode::CMasternode ( deserialize_type  ,
Stream &  s 
)
inline

Definition at line 161 of file masternode.h.

Here is the call graph for this function:

Member Function Documentation

◆ CalculateScore()

arith_uint256 CMasternode::CalculateScore ( const uint256 hash) const

Definition at line 160 of file masternode.cpp.

◆ Disable()

void CMasternode::Disable ( )
inline

Definition at line 186 of file masternode.h.

◆ GetActiveState()

CMasternode::state CMasternode::GetActiveState ( ) const

Definition at line 175 of file masternode.cpp.

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

◆ GetPayeeScript()

CScript CMasternode::GetPayeeScript ( ) const
inline

Definition at line 231 of file masternode.h.

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

◆ GetPubKey()

CPubKey CMasternode::GetPubKey ( ) const
inline

Definition at line 116 of file masternode.h.

Here is the caller graph for this function:

◆ GetSignatureHash()

uint256 CMasternode::GetSignatureHash ( ) const
overridevirtual

Implements CSignedMessage.

Definition at line 108 of file masternode.cpp.

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

◆ GetStrMessage()

std::string CMasternode::GetStrMessage ( ) const
overridevirtual

Implements CSignedMessage.

Definition at line 121 of file masternode.cpp.

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

◆ GetVin()

const CTxIn CMasternode::GetVin ( ) const
inline

Definition at line 115 of file masternode.h.

◆ IsAvailableState()

bool CMasternode::IsAvailableState ( ) const
inline

Definition at line 203 of file masternode.h.

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

◆ IsBroadcastedWithin()

bool CMasternode::IsBroadcastedWithin ( int  seconds)
inline

Definition at line 169 of file masternode.h.

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

◆ IsEnabled()

bool CMasternode::IsEnabled ( ) const
inline

Definition at line 193 of file masternode.h.

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

◆ IsPingedWithin()

bool CMasternode::IsPingedWithin ( int  seconds,
int64_t  now = -1 
) const
inline

Definition at line 174 of file masternode.h.

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

◆ IsPreEnabled()

bool CMasternode::IsPreEnabled ( ) const
inline

Definition at line 198 of file masternode.h.

Here is the call graph for this function:

◆ IsValidNetAddr()

bool CMasternode::IsValidNetAddr ( ) const
Todo:
: regtest is fine with any addresses for now,

Definition at line 193 of file masternode.cpp.

Here is the call graph for this function:

◆ operator=()

CMasternode& CMasternode::operator= ( const CMasternode other)
inline

Definition at line 120 of file masternode.h.

◆ SERIALIZE_METHODS()

CMasternode::SERIALIZE_METHODS ( CMasternode  ,
obj   
)
inline

Definition at line 147 of file masternode.h.

◆ SetLastPing()

void CMasternode::SetLastPing ( const CMasternodePing _lastPing)
inline

Definition at line 118 of file masternode.h.

◆ SetSpent()

void CMasternode::SetSpent ( )
inline

Definition at line 180 of file masternode.h.

◆ Status()

std::string CMasternode::Status ( ) const
inline

Definition at line 209 of file masternode.h.

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

◆ UpdateFromNewBroadcast()

bool CMasternode::UpdateFromNewBroadcast ( CMasternodeBroadcast mnb)
Todo:
: lock cs. Need to be careful as mnb.lastPing.CheckAndUpdate locks cs_main internally.

Definition at line 134 of file masternode.cpp.

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

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const CMasternode a,
const CMasternode b 
)
friend

Definition at line 140 of file masternode.h.

◆ operator==

bool operator== ( const CMasternode a,
const CMasternode b 
)
friend

Definition at line 136 of file masternode.h.

Member Data Documentation

◆ addr

CService CMasternode::addr

Definition at line 97 of file masternode.h.

◆ cs

RecursiveMutex CMasternode::cs
mutableprivate

Definition at line 84 of file masternode.h.

◆ fCollateralSpent

bool CMasternode::fCollateralSpent {false}
private

Definition at line 85 of file masternode.h.

◆ lastPing

CMasternodePing CMasternode::lastPing

Definition at line 104 of file masternode.h.

◆ mnPayeeScript

CScript CMasternode::mnPayeeScript {}

Definition at line 230 of file masternode.h.

◆ nLastScanningErrorBlockHeight

int CMasternode::nLastScanningErrorBlockHeight

Definition at line 103 of file masternode.h.

◆ nScanningErrorCount

int CMasternode::nScanningErrorCount

Definition at line 102 of file masternode.h.

◆ protocolVersion

int CMasternode::protocolVersion

Definition at line 101 of file masternode.h.

◆ pubKeyCollateralAddress

CPubKey CMasternode::pubKeyCollateralAddress

Definition at line 98 of file masternode.h.

◆ pubKeyMasternode

CPubKey CMasternode::pubKeyMasternode

Definition at line 99 of file masternode.h.

◆ sigTime

int64_t CMasternode::sigTime

Definition at line 100 of file masternode.h.

◆ vin

CTxIn CMasternode::vin

Definition at line 96 of file masternode.h.


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