Dash Core  0.12.2.1
P2P Digital Currency
CMasternode Class Reference

#include <masternode.h>

+ Inheritance diagram for CMasternode:

Public Types

enum  state {
  MASTERNODE_PRE_ENABLED, MASTERNODE_ENABLED, MASTERNODE_EXPIRED, MASTERNODE_OUTPOINT_SPENT,
  MASTERNODE_UPDATE_REQUIRED, MASTERNODE_WATCHDOG_EXPIRED, MASTERNODE_NEW_START_REQUIRED, MASTERNODE_POSE_BAN
}
 
enum  CollateralStatus { COLLATERAL_OK, COLLATERAL_UTXO_NOT_FOUND, COLLATERAL_INVALID_AMOUNT }
 

Public Member Functions

 CMasternode ()
 
 CMasternode (const CMasternode &other)
 
 CMasternode (const CMasternodeBroadcast &mnb)
 
 CMasternode (CService addrNew, COutPoint outpointNew, CPubKey pubKeyCollateralAddressNew, CPubKey pubKeyMasternodeNew, int nProtocolVersionIn)
 
template<typename Stream , typename Operation >
void SerializationOp (Stream &s, Operation ser_action, int nType, int nVersion)
 
arith_uint256 CalculateScore (const uint256 &blockHash)
 
bool UpdateFromNewBroadcast (CMasternodeBroadcast &mnb, CConnman &connman)
 
void Check (bool fForce=false)
 
bool IsBroadcastedWithin (int nSeconds)
 
bool IsPingedWithin (int nSeconds, int64_t nTimeToCheckAt=-1)
 
bool IsEnabled ()
 
bool IsPreEnabled ()
 
bool IsPoSeBanned ()
 
bool IsPoSeVerified ()
 
bool IsExpired ()
 
bool IsOutpointSpent ()
 
bool IsUpdateRequired ()
 
bool IsWatchdogExpired ()
 
bool IsNewStartRequired ()
 
bool IsValidForPayment ()
 
bool IsInputAssociatedWithPubkey ()
 Is the input associated with collateral public key? (and there is 1000 DASH - checking if valid masternode) More...
 
bool IsValidNetAddr ()
 
void IncreasePoSeBanScore ()
 
void DecreasePoSeBanScore ()
 
void PoSeBan ()
 
masternode_info_t GetInfo ()
 
std::string GetStateString () const
 
std::string GetStatus () const
 
int GetLastPaidTime ()
 
int GetLastPaidBlock ()
 
void UpdateLastPaid (const CBlockIndex *pindex, int nMaxBlocksToScanBack)
 
void AddGovernanceVote (uint256 nGovernanceObjectHash)
 
void FlagGovernanceItemsAsDirty ()
 
void RemoveGovernanceObject (uint256 nGovernanceObjectHash)
 
void UpdateWatchdogVoteTime (uint64_t nVoteTime=0)
 
CMasternodeoperator= (CMasternode const &from)
 
- Public Member Functions inherited from masternode_info_t
 masternode_info_t ()=default
 
 masternode_info_t (masternode_info_t const &)=default
 
 masternode_info_t (int activeState, int protoVer, int64_t sTime)
 
 masternode_info_t (int activeState, int protoVer, int64_t sTime, COutPoint const &outpoint, CService const &addr, CPubKey const &pkCollAddr, CPubKey const &pkMN, int64_t tWatchdogV=0)
 

Static Public Member Functions

static CollateralStatus CheckCollateral (const COutPoint &outpoint)
 
static CollateralStatus CheckCollateral (const COutPoint &outpoint, int &nHeightRet)
 
static bool IsValidStateForAutoStart (int nActiveStateIn)
 
static bool IsValidNetAddr (CService addrIn)
 
static std::string StateToString (int nStateIn)
 

Public Attributes

CMasternodePing lastPing {}
 
std::vector< unsigned char > vchSig {}
 
uint256 nCollateralMinConfBlockHash {}
 
int nBlockLastPaid {}
 
int nPoSeBanScore {}
 
int nPoSeBanHeight {}
 
bool fAllowMixingTx {}
 
bool fUnitTest = false
 
std::map< uint256, int > mapGovernanceObjectsVotedOn
 
 ADD_SERIALIZE_METHODS
 
- Public Attributes inherited from masternode_info_t
int nActiveState = 0
 
int nProtocolVersion = 0
 
int64_t sigTime = 0
 
CTxIn vin {}
 
CService addr {}
 
CPubKey pubKeyCollateralAddress {}
 
CPubKey pubKeyMasternode {}
 
int64_t nTimeLastWatchdogVote = 0
 
int64_t nLastDsq = 0
 
int64_t nTimeLastChecked = 0
 
int64_t nTimeLastPaid = 0
 
int64_t nTimeLastPing = 0
 
bool fInfoValid = false
 

Private Attributes

CCriticalSection cs
 

Detailed Description

Definition at line 131 of file masternode.h.

Member Enumeration Documentation

◆ CollateralStatus

Enumerator
COLLATERAL_OK 
COLLATERAL_UTXO_NOT_FOUND 
COLLATERAL_INVALID_AMOUNT 

Definition at line 149 of file masternode.h.

◆ state

Enumerator
MASTERNODE_PRE_ENABLED 
MASTERNODE_ENABLED 
MASTERNODE_EXPIRED 
MASTERNODE_OUTPOINT_SPENT 
MASTERNODE_UPDATE_REQUIRED 
MASTERNODE_WATCHDOG_EXPIRED 
MASTERNODE_NEW_START_REQUIRED 
MASTERNODE_POSE_BAN 

Definition at line 138 of file masternode.h.

Constructor & Destructor Documentation

◆ CMasternode() [1/4]

CMasternode::CMasternode ( )

Definition at line 18 of file masternode.cpp.

◆ CMasternode() [2/4]

CMasternode::CMasternode ( const CMasternode other)

Definition at line 29 of file masternode.cpp.

◆ CMasternode() [3/4]

CMasternode::CMasternode ( const CMasternodeBroadcast mnb)

Definition at line 41 of file masternode.cpp.

◆ CMasternode() [4/4]

CMasternode::CMasternode ( CService  addrNew,
COutPoint  outpointNew,
CPubKey  pubKeyCollateralAddressNew,
CPubKey  pubKeyMasternodeNew,
int  nProtocolVersionIn 
)

Definition at line 23 of file masternode.cpp.

Member Function Documentation

◆ AddGovernanceVote()

void CMasternode::AddGovernanceVote ( uint256  nGovernanceObjectHash)

Definition at line 830 of file masternode.cpp.

Referenced by CMasternodeMan::AddGovernanceVote().

◆ CalculateScore()

arith_uint256 CMasternode::CalculateScore ( const uint256 blockHash)

Definition at line 91 of file masternode.cpp.

Referenced by CMasternodeMan::GetNextMasternodeInQueueForPayment().

◆ Check()

void CMasternode::Check ( bool  fForce = false)

◆ CheckCollateral() [1/2]

CMasternode::CollateralStatus CMasternode::CheckCollateral ( const COutPoint outpoint)
static

◆ CheckCollateral() [2/2]

CMasternode::CollateralStatus CMasternode::CheckCollateral ( const COutPoint outpoint,
int &  nHeightRet 
)
static

Definition at line 122 of file masternode.cpp.

◆ DecreasePoSeBanScore()

void CMasternode::DecreasePoSeBanScore ( )
inline

Definition at line 261 of file masternode.h.

Referenced by Check(), and CMasternodeMan::ProcessVerifyReply().

◆ FlagGovernanceItemsAsDirty()

void CMasternode::FlagGovernanceItemsAsDirty ( )

FLAG GOVERNANCE ITEMS AS DIRTY

  • When masternode come and go on the network, we must flag the items they voted on to recalc it's cached flags

Definition at line 860 of file masternode.cpp.

◆ GetInfo()

◆ GetLastPaidBlock()

int CMasternode::GetLastPaidBlock ( )
inline

Definition at line 271 of file masternode.h.

Referenced by masternodelist().

◆ GetLastPaidTime()

int CMasternode::GetLastPaidTime ( )
inline

Definition at line 270 of file masternode.h.

Referenced by masternodelist().

◆ GetStateString()

std::string CMasternode::GetStateString ( ) const

◆ GetStatus()

std::string CMasternode::GetStatus ( ) const

Definition at line 314 of file masternode.cpp.

Referenced by masternodelist(), and MasternodeList::updateNodeList().

◆ IncreasePoSeBanScore()

void CMasternode::IncreasePoSeBanScore ( )
inline

◆ IsBroadcastedWithin()

bool CMasternode::IsBroadcastedWithin ( int  nSeconds)
inline

Definition at line 210 of file masternode.h.

Referenced by CMasternodeBroadcast::Update().

◆ IsEnabled()

bool CMasternode::IsEnabled ( )
inline

◆ IsExpired()

bool CMasternode::IsExpired ( )
inline

Definition at line 227 of file masternode.h.

Referenced by Check(), and CMasternodePing::CheckAndUpdate().

◆ IsInputAssociatedWithPubkey()

bool CMasternode::IsInputAssociatedWithPubkey ( )

Is the input associated with collateral public key? (and there is 1000 DASH - checking if valid masternode)

Definition at line 258 of file masternode.cpp.

Referenced by CMasternodeBroadcast::CheckOutpoint().

◆ IsNewStartRequired()

bool CMasternode::IsNewStartRequired ( )
inline

Definition at line 231 of file masternode.h.

Referenced by Check(), and CMasternodePing::CheckAndUpdate().

◆ IsOutpointSpent()

bool CMasternode::IsOutpointSpent ( )
inline

Definition at line 228 of file masternode.h.

Referenced by Check().

◆ IsPingedWithin()

bool CMasternode::IsPingedWithin ( int  nSeconds,
int64_t  nTimeToCheckAt = -1 
)
inline

◆ IsPoSeBanned()

bool CMasternode::IsPoSeBanned ( )
inline

Definition at line 224 of file masternode.h.

Referenced by Check(), and CMasternodeBroadcast::Update().

◆ IsPoSeVerified()

bool CMasternode::IsPoSeVerified ( )
inline

Definition at line 226 of file masternode.h.

Referenced by CMasternodeMan::CheckSameAddr().

◆ IsPreEnabled()

bool CMasternode::IsPreEnabled ( )
inline

Definition at line 223 of file masternode.h.

Referenced by CMasternodeMan::CheckSameAddr().

◆ IsUpdateRequired()

bool CMasternode::IsUpdateRequired ( )
inline

Definition at line 229 of file masternode.h.

Referenced by CMasternodePing::CheckAndUpdate().

◆ IsValidForPayment()

bool CMasternode::IsValidForPayment ( )
inline

Definition at line 241 of file masternode.h.

◆ IsValidNetAddr() [1/2]

bool CMasternode::IsValidNetAddr ( )

◆ IsValidNetAddr() [2/2]

bool CMasternode::IsValidNetAddr ( CService  addrIn)
static

Definition at line 278 of file masternode.cpp.

◆ IsValidStateForAutoStart()

static bool CMasternode::IsValidStateForAutoStart ( int  nActiveStateIn)
inlinestatic

◆ IsWatchdogExpired()

bool CMasternode::IsWatchdogExpired ( )
inline

Definition at line 230 of file masternode.h.

Referenced by Check(), and CMasternodePing::CheckAndUpdate().

◆ operator=()

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

Definition at line 283 of file masternode.h.

◆ PoSeBan()

void CMasternode::PoSeBan ( )
inline

Definition at line 262 of file masternode.h.

Referenced by CMasternodeMan::PoSeBan().

◆ RemoveGovernanceObject()

void CMasternode::RemoveGovernanceObject ( uint256  nGovernanceObjectHash)

Definition at line 839 of file masternode.cpp.

◆ SerializationOp()

template<typename Stream , typename Operation >
void CMasternode::SerializationOp ( Stream &  s,
Operation  ser_action,
int  nType,
int  nVersion 
)
inline

Definition at line 177 of file masternode.h.

◆ StateToString()

std::string CMasternode::StateToString ( int  nStateIn)
static

◆ UpdateFromNewBroadcast()

bool CMasternode::UpdateFromNewBroadcast ( CMasternodeBroadcast mnb,
CConnman connman 
)

Definition at line 53 of file masternode.cpp.

Referenced by CMasternodeBroadcast::Update().

◆ UpdateLastPaid()

void CMasternode::UpdateLastPaid ( const CBlockIndex pindex,
int  nMaxBlocksToScanBack 
)

Definition at line 320 of file masternode.cpp.

◆ UpdateWatchdogVoteTime()

void CMasternode::UpdateWatchdogVoteTime ( uint64_t  nVoteTime = 0)

Definition at line 848 of file masternode.cpp.

Referenced by CMasternodeMan::UpdateWatchdogVoteTime().

Member Data Documentation

◆ ADD_SERIALIZE_METHODS

CMasternode::ADD_SERIALIZE_METHODS

Definition at line 174 of file masternode.h.

◆ cs

CCriticalSection CMasternode::cs
mutableprivate

Definition at line 135 of file masternode.h.

Referenced by Check(), SerializationOp(), and UpdateWatchdogVoteTime().

◆ fAllowMixingTx

bool CMasternode::fAllowMixingTx {}

◆ fUnitTest

bool CMasternode::fUnitTest = false

Definition at line 164 of file masternode.h.

Referenced by Check(), operator=(), and SerializationOp().

◆ lastPing

◆ mapGovernanceObjectsVotedOn

std::map<uint256, int> CMasternode::mapGovernanceObjectsVotedOn

◆ nBlockLastPaid

int CMasternode::nBlockLastPaid {}

Definition at line 160 of file masternode.h.

Referenced by GetLastPaidBlock(), operator=(), SerializationOp(), and UpdateLastPaid().

◆ nCollateralMinConfBlockHash

uint256 CMasternode::nCollateralMinConfBlockHash {}

◆ nPoSeBanHeight

int CMasternode::nPoSeBanHeight {}

Definition at line 162 of file masternode.h.

Referenced by Check(), operator=(), SerializationOp(), and UpdateFromNewBroadcast().

◆ nPoSeBanScore

◆ vchSig


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