![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include <governance-classes.h>
Public Types | |
typedef std::map< COutPoint, vote_rec_t > | vote_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_t > | vote_mcache_t |
Public Member Functions | |
virtual uint256 | GetHash ()=0 |
CGovernanceObject () | |
CGovernanceObject (uint256 nHashParentIn, int nRevisionIn, int64_t nTime, uint256 nCollateralHashIn, std::string strDataIn) | |
CGovernanceObject (const CGovernanceObject &other) | |
void | swap (CGovernanceObject &first, CGovernanceObject &second) |
int64_t | GetCreationTime () const |
int64_t | GetDeletionTime () const |
int | GetObjectType () const |
const uint256 & | GetCollateralHash () const |
const CTxIn & | GetMasternodeVin () const |
bool | IsSetCachedFunding () const |
bool | IsSetCachedValid () const |
bool | IsSetCachedDelete () const |
bool | IsSetCachedEndorsed () const |
bool | IsSetDirtyCache () const |
bool | IsSetExpired () const |
void | InvalidateVoteCache () |
CGovernanceObjectVoteFile & | GetVoteFile () |
void | SetMasternodeVin (const COutPoint &outpoint) |
bool | Sign (CKey &keyMasternode, CPubKey &pubKeyMasternode) |
bool | CheckSignature (CPubKey &pubKeyMasternode) |
std::string | GetSignatureMessage () const |
bool | IsValidLocally (std::string &strError, bool fCheckCollateral) |
bool | IsValidLocally (std::string &strError, bool &fMissingMasternode, bool &fMissingConfirmations, bool fCheckCollateral) |
bool | IsCollateralValid (std::string &strError, bool &fMissingConfirmations) |
Check the collateral transaction for the budget proposal/finalized budget. More... | |
void | UpdateLocalValidity () |
void | UpdateSentinelVariables () |
int | GetObjectSubtype () |
CAmount | GetMinCollateralFee () |
UniValue | GetJSONObject () |
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 |
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) |
std::string | GetDataAsHex () |
std::string | GetDataAsString () |
template<typename Stream , typename Operation > | |
void | SerializationOp (Stream &s, Operation ser_action, int nType, int nVersion) |
CGovernanceObject & | operator= (CGovernanceObject from) |
Public Attributes | |
ADD_SERIALIZE_METHODS | |
Private Member Functions | |
void | LoadData () |
void | GetData (UniValue &objResult) |
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... | |
void | CheckOrphanVotes (CConnman &connman) |
Private Attributes | |
int | nLevel |
std::string | strCategory |
int | nStatusID |
std::string | strStatusMessage |
uint64_t | nTimeValueOverrideCached |
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::string | strData |
Data field - can be used for anything. More... | |
CTxIn | vinMasternode |
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 goverance 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 |
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 |
vote_mcache_t | mapOrphanVotes |
Limited map of votes orphaned by MN. More... | |
CGovernanceObjectVoteFile | fileVotes |
Friends | |
class | CGovernanceManager |
class | CGovernanceTriggerManager |
Governance Object
Definition at line 113 of file governance-classes.h.
typedef vote_m_t::const_iterator CGovernanceObject::vote_m_cit |
Definition at line 123 of file governance-object.h.
typedef vote_m_t::iterator CGovernanceObject::vote_m_it |
Definition at line 121 of file governance-object.h.
typedef std::map<COutPoint, vote_rec_t> CGovernanceObject::vote_m_t |
Definition at line 119 of file governance-object.h.
Definition at line 125 of file governance-object.h.
CGovernanceObject::CGovernanceObject | ( | ) |
Definition at line 17 of file governance-object.cpp.
CGovernanceObject::CGovernanceObject | ( | uint256 | nHashParentIn, |
int | nRevisionIn, | ||
int64_t | nTime, | ||
uint256 | nCollateralHashIn, | ||
std::string | strDataIn | ||
) |
Definition at line 45 of file governance-object.cpp.
CGovernanceObject::CGovernanceObject | ( | const CGovernanceObject & | other | ) |
Definition at line 73 of file governance-object.cpp.
|
private |
Definition at line 719 of file governance-object.cpp.
bool CGovernanceObject::CheckSignature | ( | CPubKey & | pubKeyMasternode | ) |
Definition at line 255 of file governance-object.cpp.
Referenced by IsValidLocally().
|
private |
Called when MN's which have voted on this object have been removed.
Definition at line 199 of file governance-object.cpp.
int CGovernanceObject::CountMatchingVotes | ( | vote_signal_enum_t | eVoteSignalIn, |
vote_outcome_enum_t | eVoteOutcomeIn | ||
) | const |
Definition at line 596 of file governance-object.cpp.
Referenced by GetAbstainCount(), GetNoCount(), and GetYesCount().
int CGovernanceObject::GetAbsoluteNoCount | ( | vote_signal_enum_t | eVoteSignalIn | ) | const |
Definition at line 622 of file governance-object.cpp.
Referenced by UpdateSentinelVariables().
int CGovernanceObject::GetAbsoluteYesCount | ( | vote_signal_enum_t | eVoteSignalIn | ) | const |
Get specific vote counts for each outcome (funding, validity, etc)
Definition at line 617 of file governance-object.cpp.
Referenced by CSuperblockManager::GetBestSuperblock(), gobject(), and UpdateSentinelVariables().
int CGovernanceObject::GetAbstainCount | ( | vote_signal_enum_t | eVoteSignalIn | ) | const |
Definition at line 637 of file governance-object.cpp.
Referenced by gobject().
|
inline |
Definition at line 215 of file governance-object.h.
Referenced by gobject().
|
inline |
Definition at line 203 of file governance-object.h.
Referenced by CGovernanceManager::AddGovernanceObject(), CGovernanceManager::CheckPostponedObjects(), gobject(), CGovernanceManager::MasternodeRateCheck(), CGovernanceManager::MasternodeRateUpdate(), CGovernanceManager::UpdateCachesAndClean(), and CGovernanceManager::UpdateCurrentWatchdog().
bool CGovernanceObject::GetCurrentMNVotes | ( | const COutPoint & | mnCollateralOutpoint, |
vote_rec_t & | voteRecord | ||
) |
Definition at line 642 of file governance-object.cpp.
Referenced by CGovernanceManager::GetCurrentVotes().
|
private |
Decode governance object data into UniValue(VOBJ)
Definition at line 376 of file governance-object.cpp.
Referenced by GetJSONObject(), and LoadData().
std::string CGovernanceObject::GetDataAsHex | ( | ) |
Definition at line 390 of file governance-object.cpp.
Referenced by gobject(), and CSuperblock::IsValid().
std::string CGovernanceObject::GetDataAsString | ( | ) |
Definition at line 395 of file governance-object.cpp.
Referenced by CGovernanceManager::AddGovernanceObject(), CGovernanceTriggerManager::CleanAndRemove(), CGovernanceTriggerManager::GetActiveTriggers(), GetData(), gobject(), CSuperblockManager::IsSuperblockTriggered(), and LoadData().
|
inline |
Definition at line 207 of file governance-object.h.
Referenced by CGovernanceManager::UpdateCachesAndClean().
|
pure virtual |
Implemented in CDashNetwork.
Referenced by CGovernanceManager::AddCachedTriggers(), CGovernanceManager::AddGovernanceObject(), CGovernanceManager::AddPostponedObject(), CGovernanceManager::CheckOrphanVotes(), CGovernanceManager::CheckPostponedObjects(), CGovernanceTriggerManager::CleanAndRemove(), gobject(), IsCollateralValid(), CGovernanceManager::MasternodeRateCheck(), CGovernanceManager::MasternodeRateUpdate(), ProcessVote(), Relay(), SerializationOp(), CGovernanceManager::UpdateCachesAndClean(), and CGovernanceManager::UpdateCurrentWatchdog().
uint256 CGovernanceObject::GetHash | ( | ) | const |
Definition at line 279 of file governance-object.cpp.
UniValue CGovernanceObject::GetJSONObject | ( | ) |
Return the actual object from the strData JSON structure.
Returns an empty object on error.
Definition at line 303 of file governance-object.cpp.
Referenced by LoadData().
|
inline |
Definition at line 219 of file governance-object.h.
Referenced by CGovernanceManager::CheckMasternodeOrphanObjects(), gobject(), CGovernanceManager::MasternodeRateCheck(), and CGovernanceManager::MasternodeRateUpdate().
CAmount CGovernanceObject::GetMinCollateralFee | ( | ) |
Definition at line 491 of file governance-object.cpp.
Referenced by gobject(), and IsCollateralValid().
int CGovernanceObject::GetNoCount | ( | vote_signal_enum_t | eVoteSignalIn | ) | const |
Definition at line 632 of file governance-object.cpp.
Referenced by GetAbsoluteNoCount(), GetAbsoluteYesCount(), and gobject().
int CGovernanceObject::GetObjectSubtype | ( | ) |
Definition at line 270 of file governance-object.cpp.
|
inline |
Definition at line 211 of file governance-object.h.
Referenced by CGovernanceManager::AddGovernanceObject(), CGovernanceManager::CheckPostponedObjects(), CGovernanceTriggerManager::CleanAndRemove(), gobject(), CGovernanceManager::MasternodeRateCheck(), CGovernanceManager::MasternodeRateUpdate(), CGovernanceManager::ProcessVote(), and CGovernanceManager::UpdateCachesAndClean().
std::string CGovernanceObject::GetSignatureMessage | ( | ) | const |
Definition at line 213 of file governance-object.cpp.
Referenced by CheckSignature(), and Sign().
|
inline |
Definition at line 251 of file governance-object.h.
Referenced by CGovernanceManager::GetMatchingVotes(), CGovernanceManager::HaveVoteForHash(), CGovernanceManager::RebuildIndexes(), CGovernanceManager::RequestGovernanceObject(), CGovernanceManager::SerializeVoteForHash(), and CGovernanceManager::Sync().
int CGovernanceObject::GetYesCount | ( | vote_signal_enum_t | eVoteSignalIn | ) | const |
Definition at line 627 of file governance-object.cpp.
Referenced by GetAbsoluteNoCount(), GetAbsoluteYesCount(), and gobject().
|
inline |
Definition at line 247 of file governance-object.h.
bool CGovernanceObject::IsCollateralValid | ( | std::string & | strError, |
bool & | fMissingConfirmations | ||
) |
Check the collateral transaction for the budget proposal/finalized budget.
Definition at line 502 of file governance-object.cpp.
Referenced by CGovernanceManager::CheckPostponedObjects(), and IsValidLocally().
|
inline |
Definition at line 231 of file governance-object.h.
Referenced by gobject(), CGovernanceManager::ProcessVote(), CGovernanceManager::Sync(), and CGovernanceManager::UpdateCachesAndClean().
|
inline |
Definition at line 235 of file governance-object.h.
Referenced by gobject().
|
inline |
Definition at line 223 of file governance-object.h.
Referenced by gobject(), and CSuperblockManager::IsSuperblockTriggered().
|
inline |
Definition at line 227 of file governance-object.h.
Referenced by gobject().
|
inline |
Definition at line 239 of file governance-object.h.
Referenced by CGovernanceManager::UpdateCachesAndClean().
|
inline |
Definition at line 243 of file governance-object.h.
Referenced by CGovernanceManager::ProcessVote(), CGovernanceManager::Sync(), and CGovernanceManager::UpdateCachesAndClean().
bool CGovernanceObject::IsValidLocally | ( | std::string & | strError, |
bool | fCheckCollateral | ||
) |
Definition at line 411 of file governance-object.cpp.
Referenced by CGovernanceManager::AddGovernanceObject(), CGovernanceManager::CheckMasternodeOrphanObjects(), CGovernanceManager::CheckPostponedObjects(), gobject(), and UpdateLocalValidity().
bool CGovernanceObject::IsValidLocally | ( | std::string & | strError, |
bool & | fMissingMasternode, | ||
bool & | fMissingConfirmations, | ||
bool | fCheckCollateral | ||
) |
Definition at line 419 of file governance-object.cpp.
|
private |
Attempt to load data from strData
Definition at line 328 of file governance-object.cpp.
Referenced by CGovernanceObject().
|
inline |
Definition at line 333 of file governance-object.h.
|
private |
Definition at line 98 of file governance-object.cpp.
Referenced by CheckOrphanVotes(), CGovernanceManager::CheckOrphanVotes(), and CGovernanceManager::ProcessVote().
void CGovernanceObject::Relay | ( | CConnman & | connman | ) |
Definition at line 652 of file governance-object.cpp.
Referenced by CGovernanceManager::AddGovernanceObject(), CGovernanceManager::CheckPostponedObjects(), and gobject().
|
inline |
Definition at line 308 of file governance-object.h.
void CGovernanceObject::SetMasternodeVin | ( | const COutPoint & | outpoint | ) |
Definition at line 226 of file governance-object.cpp.
Referenced by gobject().
Definition at line 231 of file governance-object.cpp.
Referenced by gobject().
void CGovernanceObject::swap | ( | CGovernanceObject & | first, |
CGovernanceObject & | second | ||
) |
Definition at line 695 of file governance-object.cpp.
Referenced by operator=().
void CGovernanceObject::UpdateLocalValidity | ( | ) |
Definition at line 403 of file governance-object.cpp.
Referenced by CGovernanceManager::UpdateCachesAndClean().
void CGovernanceObject::UpdateSentinelVariables | ( | ) |
Definition at line 658 of file governance-object.cpp.
Referenced by CGovernanceManager::AddGovernanceObject(), CSuperblockManager::IsSuperblockTriggered(), and CGovernanceManager::UpdateCachesAndClean().
|
friend |
Definition at line 114 of file governance-object.h.
|
friend |
Definition at line 116 of file governance-object.h.
CGovernanceObject::ADD_SERIALIZE_METHODS |
Definition at line 305 of file governance-object.h.
|
mutableprivate |
critical section to protect the inner data structures
Definition at line 129 of file governance-object.h.
Referenced by CheckSignature(), GetSignatureMessage(), and Sign().
|
private |
true == minimum network support has been reached saying this object should be deleted from the system entirely
Definition at line 169 of file governance-object.h.
Referenced by IsSetCachedDelete(), swap(), and UpdateSentinelVariables().
|
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 174 of file governance-object.h.
Referenced by IsSetCachedEndorsed(), swap(), and UpdateSentinelVariables().
|
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 163 of file governance-object.h.
Referenced by IsSetCachedFunding(), swap(), and UpdateSentinelVariables().
|
private |
is valid by blockchain
Definition at line 157 of file governance-object.h.
Referenced by UpdateLocalValidity().
|
private |
true == minimum network has been reached flagging this object as a valid and understood goverance object (e.g, the serialized data is correct format, etc)
Definition at line 166 of file governance-object.h.
Referenced by IsSetCachedValid(), swap(), and UpdateSentinelVariables().
|
private |
object was updated and cached values should be updated soon
Definition at line 177 of file governance-object.h.
Referenced by InvalidateVoteCache(), IsSetDirtyCache(), ProcessVote(), swap(), and UpdateSentinelVariables().
|
private |
Object is no longer of interest.
Definition at line 180 of file governance-object.h.
Referenced by CGovernanceTriggerManager::CleanAndRemove(), IsSetExpired(), SerializationOp(), and swap().
|
private |
Definition at line 190 of file governance-object.h.
Referenced by ClearMasternodeVotes(), GetVoteFile(), ProcessVote(), and SerializationOp().
|
private |
Failed to parse object data.
Definition at line 183 of file governance-object.h.
Referenced by IsValidLocally(), and LoadData().
|
private |
Definition at line 185 of file governance-object.h.
Referenced by ClearMasternodeVotes(), CountMatchingVotes(), GetCurrentMNVotes(), ProcessVote(), and SerializationOp().
|
private |
Limited map of votes orphaned by MN.
Definition at line 188 of file governance-object.h.
Referenced by CheckOrphanVotes(), and ProcessVote().
|
private |
fee-tx
Definition at line 147 of file governance-object.h.
Referenced by GetCollateralHash(), GetSignatureMessage(), IsCollateralValid(), CDashNetwork::SerializationOp(), SerializationOp(), and swap().
|
private |
time this object was marked for deletion
Definition at line 144 of file governance-object.h.
Referenced by CGovernanceTriggerManager::CleanAndRemove(), GetDeletionTime(), SerializationOp(), swap(), and UpdateSentinelVariables().
|
private |
parent object, 0 is root
Definition at line 135 of file governance-object.h.
Referenced by GetHash(), GetSignatureMessage(), SerializationOp(), and swap().
|
private |
Definition at line 117 of file governance-classes.h.
|
private |
Object typecode.
Definition at line 132 of file governance-object.h.
Referenced by CGovernanceManager::AddCachedTriggers(), CGovernanceManager::AddGovernanceObject(), GetMinCollateralFee(), GetObjectSubtype(), GetObjectType(), IsValidLocally(), LoadData(), SerializationOp(), and swap().
|
private |
object revision in the system
Definition at line 138 of file governance-object.h.
Referenced by GetHash(), GetSignatureMessage(), SerializationOp(), and swap().
|
private |
Definition at line 121 of file governance-classes.h.
|
private |
time this object was created
Definition at line 141 of file governance-object.h.
Referenced by GetCreationTime(), CDashNetwork::GetHash(), GetHash(), GetSignatureMessage(), CDashNetwork::SerializationOp(), SerializationOp(), and swap().
|
private |
Definition at line 125 of file governance-classes.h.
|
private |
Definition at line 118 of file governance-classes.h.
|
private |
Data field - can be used for anything.
Definition at line 150 of file governance-object.h.
Referenced by GetDataAsHex(), GetDataAsString(), GetHash(), GetJSONObject(), GetSignatureMessage(), LoadData(), SerializationOp(), and swap().
|
private |
Definition at line 158 of file governance-object.h.
Referenced by UpdateLocalValidity().
|
private |
Definition at line 122 of file governance-classes.h.
|
private |
Definition at line 154 of file governance-object.h.
Referenced by CheckSignature(), GetHash(), SerializationOp(), and Sign().
|
private |
Masternode info for signed objects.
Definition at line 153 of file governance-object.h.
Referenced by GetHash(), GetMasternodeVin(), GetSignatureMessage(), IsValidLocally(), SerializationOp(), SetMasternodeVin(), and Sign().