Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

Governance Object. More...

#include <governance-object.h>

+ Inheritance diagram for CGovernanceObject:
+ Collaboration diagram for CGovernanceObject:

Public Types

typedef std::map< COutPoint, vote_rec_tvote_m_t
 
typedef vote_m_t::iterator vote_m_it
 
typedef vote_m_t::const_iterator vote_m_cit
 
typedef CacheMultiMap< COutPoint, vote_time_pair_tvote_cmm_t
 

Public Member Functions

 CGovernanceObject ()
 
 CGovernanceObject (const uint256 &nHashParentIn, int nRevisionIn, int64_t nTime, const uint256 &nCollateralHashIn, const std::string &strDataHexIn)
 
 CGovernanceObject (const CGovernanceObject &other)
 
int64_t GetCreationTime () const
 
int64_t GetDeletionTime () const
 
int GetObjectType () const
 
const uint256GetCollateralHash () const
 
const COutPointGetMasternodeOutpoint () const
 
bool IsSetCachedFunding () const
 
bool IsSetCachedValid () const
 
bool IsSetCachedDelete () const
 
bool IsSetCachedEndorsed () const
 
bool IsSetDirtyCache () const
 
bool IsSetExpired () const
 
void SetExpired ()
 
const CGovernanceObjectVoteFileGetVoteFile () const
 
void SetMasternodeOutpoint (const COutPoint &outpoint)
 
bool Sign (const CBLSSecretKey &key)
 
bool CheckSignature (const CBLSPublicKey &pubKey) const
 
uint256 GetSignatureHash () const
 
bool IsValidLocally (std::string &strError, bool fCheckCollateral) const
 
bool IsValidLocally (std::string &strError, bool &fMissingConfirmations, bool fCheckCollateral) const
 
bool IsCollateralValid (std::string &strError, bool &fMissingConfirmations) const
 Check the collateral transaction for the budget proposal/finalized budget. More...
 
void UpdateLocalValidity ()
 
void UpdateSentinelVariables ()
 
void PrepareDeletion (int64_t nDeletionTime_)
 
CAmount GetMinCollateralFee () const
 
UniValue GetJSONObject ()
 Return the actual object from the vchData JSON structure. More...
 
void Relay (CConnman &connman)
 
uint256 GetHash () const
 
int CountMatchingVotes (vote_signal_enum_t eVoteSignalIn, vote_outcome_enum_t eVoteOutcomeIn) const
 
int GetAbsoluteYesCount (vote_signal_enum_t eVoteSignalIn) const
 Get specific vote counts for each outcome (funding, validity, etc) More...
 
int GetAbsoluteNoCount (vote_signal_enum_t eVoteSignalIn) const
 
int GetYesCount (vote_signal_enum_t eVoteSignalIn) const
 
int GetNoCount (vote_signal_enum_t eVoteSignalIn) const
 
int GetAbstainCount (vote_signal_enum_t eVoteSignalIn) const
 
bool GetCurrentMNVotes (const COutPoint &mnCollateralOutpoint, vote_rec_t &voteRecord) const
 
std::string GetDataAsHexString () const
 

GetData - As

More...
 
std::string GetDataAsPlainString () const
 
template<typename Stream , typename Operation >
void SerializationOp (Stream &s, Operation ser_action)
 
void LoadData ()
 

LoadData

More...
 
void GetData (UniValue &objResult)
 

GetData - Example usage:

More...
 
bool ProcessVote (CNode *pfrom, const CGovernanceVote &vote, CGovernanceException &exception, CConnman &connman)
 
void ClearMasternodeVotes ()
 Called when MN's which have voted on this object have been removed. More...
 
std::set< uint256RemoveInvalidVotes (const COutPoint &mnOutpoint)
 

Public Attributes

 ADD_SERIALIZE_METHODS
 

Private Attributes

CCriticalSection cs
 critical section to protect the inner data structures More...
 
int nObjectType
 Object typecode. More...
 
uint256 nHashParent
 parent object, 0 is root More...
 
int nRevision
 object revision in the system More...
 
int64_t nTime
 time this object was created More...
 
int64_t nDeletionTime
 time this object was marked for deletion More...
 
uint256 nCollateralHash
 fee-tx More...
 
std::vector< unsigned char > vchData
 Data field - can be used for anything. More...
 
COutPoint masternodeOutpoint
 Masternode info for signed objects. More...
 
std::vector< unsigned char > vchSig
 
bool fCachedLocalValidity
 is valid by blockchain More...
 
std::string strLocalValidityError
 
bool fCachedFunding
 true == minimum network support has been reached for this object to be funded (doesn't mean it will for sure though) More...
 
bool fCachedValid
 true == minimum network has been reached flagging this object as a valid and understood governance object (e.g, the serialized data is correct format, etc) More...
 
bool fCachedDelete
 true == minimum network support has been reached saying this object should be deleted from the system entirely More...
 
bool fCachedEndorsed
 true == minimum network support has been reached flagging this object as endorsed by an elected representative body (e.g. More...
 
bool fDirtyCache
 object was updated and cached values should be updated soon More...
 
bool fExpired
 Object is no longer of interest. More...
 
bool fUnparsable
 Failed to parse object data. More...
 
vote_m_t mapCurrentMNVotes
 
CGovernanceObjectVoteFile fileVotes
 

Detailed Description

Governance Object.

Definition at line 107 of file governance-object.h.

Member Typedef Documentation

◆ vote_cmm_t

◆ vote_m_cit

typedef vote_m_t::const_iterator CGovernanceObject::vote_m_cit

Definition at line 114 of file governance-object.h.

◆ vote_m_it

typedef vote_m_t::iterator CGovernanceObject::vote_m_it

Definition at line 112 of file governance-object.h.

◆ vote_m_t

Definition at line 110 of file governance-object.h.

Constructor & Destructor Documentation

◆ CGovernanceObject() [1/3]

CGovernanceObject::CGovernanceObject ( )

Definition at line 21 of file governance-object.cpp.

References LoadData().

◆ CGovernanceObject() [2/3]

CGovernanceObject::CGovernanceObject ( const uint256 nHashParentIn,
int  nRevisionIn,
int64_t  nTime,
const uint256 nCollateralHashIn,
const std::string &  strDataHexIn 
)

Definition at line 48 of file governance-object.cpp.

References LoadData().

◆ CGovernanceObject() [3/3]

CGovernanceObject::CGovernanceObject ( const CGovernanceObject other)

Definition at line 75 of file governance-object.cpp.

Member Function Documentation

◆ CheckSignature()

bool CGovernanceObject::CheckSignature ( const CBLSPublicKey pubKey) const

◆ ClearMasternodeVotes()

void CGovernanceObject::ClearMasternodeVotes ( )

Called when MN's which have voted on this object have been removed.

Definition at line 219 of file governance-object.cpp.

References cs, deterministicMNManager, fDirtyCache, fileVotes, LOCK, mapCurrentMNVotes, and CGovernanceObjectVoteFile::RemoveVotesFromMasternode().

◆ CountMatchingVotes()

int CGovernanceObject::CountMatchingVotes ( vote_signal_enum_t  eVoteSignalIn,
vote_outcome_enum_t  eVoteOutcomeIn 
) const

Definition at line 594 of file governance-object.cpp.

References cs, LOCK, mapCurrentMNVotes, and vote_rec_t::mapInstances.

Referenced by GetAbstainCount(), GetNoCount(), and GetYesCount().

◆ GetAbsoluteNoCount()

int CGovernanceObject::GetAbsoluteNoCount ( vote_signal_enum_t  eVoteSignalIn) const

Definition at line 618 of file governance-object.cpp.

References GetNoCount(), and GetYesCount().

Referenced by UpdateSentinelVariables().

◆ GetAbsoluteYesCount()

int CGovernanceObject::GetAbsoluteYesCount ( vote_signal_enum_t  eVoteSignalIn) const

Get specific vote counts for each outcome (funding, validity, etc)

Definition at line 613 of file governance-object.cpp.

References GetNoCount(), and GetYesCount().

Referenced by CSuperblockManager::GetBestSuperblock(), gobject_get(), and UpdateSentinelVariables().

◆ GetAbstainCount()

int CGovernanceObject::GetAbstainCount ( vote_signal_enum_t  eVoteSignalIn) const

Definition at line 633 of file governance-object.cpp.

References CountMatchingVotes(), and VOTE_OUTCOME_ABSTAIN.

Referenced by gobject_get().

◆ GetCollateralHash()

const uint256& CGovernanceObject::GetCollateralHash ( ) const
inline

Definition at line 204 of file governance-object.h.

References nCollateralHash.

Referenced by gobject_get().

◆ GetCreationTime()

◆ GetCurrentMNVotes()

bool CGovernanceObject::GetCurrentMNVotes ( const COutPoint mnCollateralOutpoint,
vote_rec_t voteRecord 
) const

Definition at line 638 of file governance-object.cpp.

References cs, LOCK, and mapCurrentMNVotes.

Referenced by CGovernanceManager::GetCurrentVotes().

◆ GetData()

void CGovernanceObject::GetData ( UniValue objResult)

GetData - Example usage:

Decode governance object data into UniValue(VOBJ)

Definition at line 398 of file governance-object.cpp.

References GetDataAsPlainString(), UniValue::read(), and UniValue::VOBJ.

Referenced by GetJSONObject(), and LoadData().

◆ GetDataAsHexString()

std::string CGovernanceObject::GetDataAsHexString ( ) const

◆ GetDataAsPlainString()

◆ GetDeletionTime()

int64_t CGovernanceObject::GetDeletionTime ( ) const
inline

Definition at line 194 of file governance-object.h.

References nDeletionTime.

Referenced by CGovernanceManager::UpdateCachesAndClean().

◆ GetHash()

◆ GetJSONObject()

UniValue CGovernanceObject::GetJSONObject ( )

Return the actual object from the vchData JSON structure.

Returns an empty object on error.

Definition at line 332 of file governance-object.cpp.

References GetData(), UniValue::getValues(), UniValue::isObject(), vchData, and UniValue::VOBJ.

Referenced by CSuperblock::CSuperblock(), and LoadData().

◆ GetMasternodeOutpoint()

const COutPoint& CGovernanceObject::GetMasternodeOutpoint ( ) const
inline

◆ GetMinCollateralFee()

CAmount CGovernanceObject::GetMinCollateralFee ( ) const

◆ GetNoCount()

int CGovernanceObject::GetNoCount ( vote_signal_enum_t  eVoteSignalIn) const

◆ GetObjectType()

◆ GetSignatureHash()

uint256 CGovernanceObject::GetSignatureHash ( ) const

Definition at line 296 of file governance-object.cpp.

References SerializeHash().

Referenced by CheckSignature(), and Sign().

◆ GetVoteFile()

◆ GetYesCount()

int CGovernanceObject::GetYesCount ( vote_signal_enum_t  eVoteSignalIn) const

◆ IsCollateralValid()

bool CGovernanceObject::IsCollateralValid ( std::string &  strError,
bool &  fMissingConfirmations 
) const

◆ IsSetCachedDelete()

bool CGovernanceObject::IsSetCachedDelete ( ) const
inline

◆ IsSetCachedEndorsed()

bool CGovernanceObject::IsSetCachedEndorsed ( ) const
inline

Definition at line 229 of file governance-object.h.

References fCachedEndorsed.

Referenced by gobject_get().

◆ IsSetCachedFunding()

bool CGovernanceObject::IsSetCachedFunding ( ) const
inline

Definition at line 214 of file governance-object.h.

References fCachedFunding.

Referenced by gobject_get(), and CSuperblockManager::IsSuperblockTriggered().

◆ IsSetCachedValid()

bool CGovernanceObject::IsSetCachedValid ( ) const
inline

Definition at line 219 of file governance-object.h.

References fCachedValid.

Referenced by gobject_get().

◆ IsSetDirtyCache()

bool CGovernanceObject::IsSetDirtyCache ( ) const
inline

Definition at line 234 of file governance-object.h.

References fDirtyCache.

Referenced by CGovernanceManager::UpdateCachesAndClean().

◆ IsSetExpired()

bool CGovernanceObject::IsSetExpired ( ) const
inline

◆ IsValidLocally() [1/2]

bool CGovernanceObject::IsValidLocally ( std::string &  strError,
bool  fCheckCollateral 
) const

◆ IsValidLocally() [2/2]

bool CGovernanceObject::IsValidLocally ( std::string &  strError,
bool &  fMissingConfirmations,
bool  fCheckCollateral 
) const

◆ LoadData()

void CGovernanceObject::LoadData ( )

LoadData

Attempt to load data from vchData

Definition at line 361 of file governance-object.cpp.

References fUnparsable, UniValue::get_int(), GetData(), GetDataAsPlainString(), GetJSONObject(), BCLog::GOBJECT, LogPrint, LogPrintf, nObjectType, vchData, and UniValue::VOBJ.

Referenced by CGovernanceObject().

◆ PrepareDeletion()

void CGovernanceObject::PrepareDeletion ( int64_t  nDeletionTime_)
inline

◆ ProcessVote()

◆ Relay()

◆ RemoveInvalidVotes()

◆ SerializationOp()

template<typename Stream , typename Operation >
void CGovernanceObject::SerializationOp ( Stream &  s,
Operation  ser_action 
)
inline

◆ SetExpired()

void CGovernanceObject::SetExpired ( )
inline

Definition at line 244 of file governance-object.h.

References fExpired.

Referenced by CGovernanceTriggerManager::CleanAndRemove().

◆ SetMasternodeOutpoint()

void CGovernanceObject::SetMasternodeOutpoint ( const COutPoint outpoint)

Definition at line 301 of file governance-object.cpp.

References masternodeOutpoint.

Referenced by gobject_submit().

◆ Sign()

◆ UpdateLocalValidity()

void CGovernanceObject::UpdateLocalValidity ( )

◆ UpdateSentinelVariables()

Member Data Documentation

◆ ADD_SERIALIZE_METHODS

CGovernanceObject::ADD_SERIALIZE_METHODS

Definition at line 310 of file governance-object.h.

◆ cs

CCriticalSection CGovernanceObject::cs
mutableprivate

critical section to protect the inner data structures

Definition at line 120 of file governance-object.h.

Referenced by ClearMasternodeVotes(), CountMatchingVotes(), GetCurrentMNVotes(), ProcessVote(), and RemoveInvalidVotes().

◆ fCachedDelete

bool CGovernanceObject::fCachedDelete
private

true == minimum network support has been reached saying this object should be deleted from the system entirely

Definition at line 160 of file governance-object.h.

Referenced by IsSetCachedDelete(), PrepareDeletion(), and UpdateSentinelVariables().

◆ fCachedEndorsed

bool CGovernanceObject::fCachedEndorsed
private

true == minimum network support has been reached flagging this object as endorsed by an elected representative body (e.g.

business review board / technecial review board /etc)

Definition at line 165 of file governance-object.h.

Referenced by IsSetCachedEndorsed(), and UpdateSentinelVariables().

◆ fCachedFunding

bool CGovernanceObject::fCachedFunding
private

true == minimum network support has been reached for this object to be funded (doesn't mean it will for sure though)

Definition at line 154 of file governance-object.h.

Referenced by IsSetCachedFunding(), and UpdateSentinelVariables().

◆ fCachedLocalValidity

bool CGovernanceObject::fCachedLocalValidity
private

is valid by blockchain

Definition at line 148 of file governance-object.h.

Referenced by UpdateLocalValidity().

◆ fCachedValid

bool CGovernanceObject::fCachedValid
private

true == minimum network has been reached flagging this object as a valid and understood governance object (e.g, the serialized data is correct format, etc)

Definition at line 157 of file governance-object.h.

Referenced by IsSetCachedValid(), and UpdateSentinelVariables().

◆ fDirtyCache

bool CGovernanceObject::fDirtyCache
private

object was updated and cached values should be updated soon

Definition at line 168 of file governance-object.h.

Referenced by ClearMasternodeVotes(), IsSetDirtyCache(), ProcessVote(), RemoveInvalidVotes(), and UpdateSentinelVariables().

◆ fExpired

bool CGovernanceObject::fExpired
private

Object is no longer of interest.

Definition at line 171 of file governance-object.h.

Referenced by IsSetExpired(), SerializationOp(), and SetExpired().

◆ fileVotes

CGovernanceObjectVoteFile CGovernanceObject::fileVotes
private

◆ fUnparsable

bool CGovernanceObject::fUnparsable
private

Failed to parse object data.

Definition at line 174 of file governance-object.h.

Referenced by IsValidLocally(), and LoadData().

◆ mapCurrentMNVotes

vote_m_t CGovernanceObject::mapCurrentMNVotes
private

◆ masternodeOutpoint

COutPoint CGovernanceObject::masternodeOutpoint
private

Masternode info for signed objects.

Definition at line 144 of file governance-object.h.

Referenced by GetHash(), GetMasternodeOutpoint(), IsValidLocally(), SerializationOp(), and SetMasternodeOutpoint().

◆ nCollateralHash

uint256 CGovernanceObject::nCollateralHash
private

fee-tx

Definition at line 138 of file governance-object.h.

Referenced by GetCollateralHash(), IsCollateralValid(), and SerializationOp().

◆ nDeletionTime

int64_t CGovernanceObject::nDeletionTime
private

time this object was marked for deletion

Definition at line 135 of file governance-object.h.

Referenced by GetDeletionTime(), PrepareDeletion(), SerializationOp(), and UpdateSentinelVariables().

◆ nHashParent

uint256 CGovernanceObject::nHashParent
private

parent object, 0 is root

Definition at line 126 of file governance-object.h.

Referenced by GetHash(), and SerializationOp().

◆ nObjectType

int CGovernanceObject::nObjectType
private

◆ nRevision

int CGovernanceObject::nRevision
private

object revision in the system

Definition at line 129 of file governance-object.h.

Referenced by GetHash(), and SerializationOp().

◆ nTime

int64_t CGovernanceObject::nTime
private

time this object was created

Definition at line 132 of file governance-object.h.

Referenced by GetCreationTime(), GetHash(), and SerializationOp().

◆ strLocalValidityError

std::string CGovernanceObject::strLocalValidityError
private

Definition at line 149 of file governance-object.h.

Referenced by UpdateLocalValidity().

◆ vchData

std::vector<unsigned char> CGovernanceObject::vchData
private

Data field - can be used for anything.

Definition at line 141 of file governance-object.h.

Referenced by GetDataAsHexString(), GetDataAsPlainString(), GetJSONObject(), LoadData(), and SerializationOp().

◆ vchSig

std::vector<unsigned char> CGovernanceObject::vchSig
private

Definition at line 145 of file governance-object.h.

Referenced by CheckSignature(), GetHash(), SerializationOp(), and Sign().


The documentation for this class was generated from the following files:
Released under the MIT license