Dash Core  0.12.2.1
P2P Digital Currency
CGovernanceVote Class Reference

#include <governance-vote.h>

Public Member Functions

 CGovernanceVote ()
 
 CGovernanceVote (COutPoint outpointMasternodeIn, uint256 nParentHashIn, vote_signal_enum_t eVoteSignalIn, vote_outcome_enum_t eVoteOutcomeIn)
 
bool IsValid () const
 
bool IsSynced () const
 
int64_t GetTimestamp () const
 
vote_signal_enum_t GetSignal () const
 
vote_outcome_enum_t GetOutcome () const
 
const uint256GetParentHash () const
 
void SetTime (int64_t nTimeIn)
 
void SetSignature (const std::vector< unsigned char > &vchSigIn)
 
bool Sign (CKey &keyMasternode, CPubKey &pubKeyMasternode)
 
bool IsValid (bool fSignatureCheck) const
 
void Relay (CConnman &connman) const
 
std::string GetVoteString () const
 
const COutPointGetMasternodeOutpoint () const
 
uint256 GetHash () const
 
std::string ToString () const
 
uint256 GetTypeHash () const
 
template<typename Stream , typename Operation >
void SerializationOp (Stream &s, Operation ser_action, int nType, int nVersion)
 

Public Attributes

 ADD_SERIALIZE_METHODS
 

Private Attributes

bool fValid
 
bool fSynced
 
int nVoteSignal
 
CTxIn vinMasternode
 
uint256 nParentHash
 
int nVoteOutcome
 
int64_t nTime
 
std::vector< unsigned char > vchSig
 

Friends

bool operator== (const CGovernanceVote &vote1, const CGovernanceVote &vote2)
 
bool operator< (const CGovernanceVote &vote1, const CGovernanceVote &vote2)
 

Detailed Description

Definition at line 88 of file governance-vote.h.

Constructor & Destructor Documentation

◆ CGovernanceVote() [1/2]

CGovernanceVote::CGovernanceVote ( )

Definition at line 205 of file governance-vote.cpp.

◆ CGovernanceVote() [2/2]

CGovernanceVote::CGovernanceVote ( COutPoint  outpointMasternodeIn,
uint256  nParentHashIn,
vote_signal_enum_t  eVoteSignalIn,
vote_outcome_enum_t  eVoteOutcomeIn 
)

Definition at line 216 of file governance-vote.cpp.

Member Function Documentation

◆ GetHash()

◆ GetMasternodeOutpoint()

const COutPoint& CGovernanceVote::GetMasternodeOutpoint ( ) const
inline

◆ GetOutcome()

vote_outcome_enum_t CGovernanceVote::GetOutcome ( ) const
inline

Definition at line 116 of file governance-vote.h.

Referenced by CGovernanceObject::ProcessVote().

◆ GetParentHash()

const uint256& CGovernanceVote::GetParentHash ( ) const
inline

◆ GetSignal()

vote_signal_enum_t CGovernanceVote::GetSignal ( ) const
inline

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

Referenced by CGovernanceObject::ProcessVote().

◆ GetTimestamp()

int64_t CGovernanceVote::GetTimestamp ( ) const
inline

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

Referenced by CGovernanceObject::ProcessVote().

◆ GetTypeHash()

uint256 CGovernanceVote::GetTypeHash ( ) const
inline

GetTypeHash()

GET HASH WITH DETERMINISTIC VALUE OF MASTERNODE-VIN/PARENT-HASH/VOTE-SIGNAL

This hash collides with previous masternode votes when they update their votes on governance objects. With 12.1 there's various types of votes (funding, valid, delete, etc), so this is the deterministic hash that will collide with the previous vote and allow the system to update.


We do not include an outcome, because that can change when a masternode updates their vote from yes to no on funding a specific project for example. We do not include a time because it will be updated each time the vote is updated, changing the hash

Definition at line 176 of file governance-vote.h.

◆ GetVoteString()

std::string CGovernanceVote::GetVoteString ( ) const
inline

Definition at line 128 of file governance-vote.h.

◆ IsSynced()

bool CGovernanceVote::IsSynced ( ) const
inline

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

◆ IsValid() [1/2]

bool CGovernanceVote::IsValid ( ) const
inline

Definition at line 108 of file governance-vote.h.

Referenced by CGovernanceObject::ProcessVote(), and voteraw().

◆ IsValid() [2/2]

bool CGovernanceVote::IsValid ( bool  fSignatureCheck) const

Definition at line 256 of file governance-vote.cpp.

◆ Relay()

void CGovernanceVote::Relay ( CConnman connman) const

◆ SerializationOp()

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

Definition at line 192 of file governance-vote.h.

◆ SetSignature()

void CGovernanceVote::SetSignature ( const std::vector< unsigned char > &  vchSigIn)
inline

Definition at line 122 of file governance-vote.h.

Referenced by voteraw().

◆ SetTime()

void CGovernanceVote::SetTime ( int64_t  nTimeIn)
inline

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

Referenced by CGovernanceManager::GetCurrentVotes(), and voteraw().

◆ Sign()

bool CGovernanceVote::Sign ( CKey keyMasternode,
CPubKey pubKeyMasternode 
)

Definition at line 233 of file governance-vote.cpp.

Referenced by gobject().

◆ ToString()

std::string CGovernanceVote::ToString ( ) const
inline

Definition at line 151 of file governance-vote.h.

Referenced by gobject(), and IsValid().

Friends And Related Function Documentation

◆ operator<

bool operator< ( const CGovernanceVote vote1,
const CGovernanceVote vote2 
)
friend

Definition at line 307 of file governance-vote.cpp.

◆ operator==

bool operator== ( const CGovernanceVote vote1,
const CGovernanceVote vote2 
)
friend

Definition at line 297 of file governance-vote.cpp.

Member Data Documentation

◆ ADD_SERIALIZE_METHODS

CGovernanceVote::ADD_SERIALIZE_METHODS

Definition at line 189 of file governance-vote.h.

◆ fSynced

bool CGovernanceVote::fSynced
private

Definition at line 96 of file governance-vote.h.

◆ fValid

bool CGovernanceVote::fValid
private

Definition at line 95 of file governance-vote.h.

◆ nParentHash

uint256 CGovernanceVote::nParentHash
private

Definition at line 99 of file governance-vote.h.

Referenced by IsValid(), operator<(), operator==(), and Sign().

◆ nTime

int64_t CGovernanceVote::nTime
private

Definition at line 101 of file governance-vote.h.

Referenced by IsValid(), operator<(), operator==(), and Sign().

◆ nVoteOutcome

int CGovernanceVote::nVoteOutcome
private

Definition at line 100 of file governance-vote.h.

Referenced by IsValid(), operator<(), operator==(), and Sign().

◆ nVoteSignal

int CGovernanceVote::nVoteSignal
private

Definition at line 97 of file governance-vote.h.

Referenced by IsValid(), operator<(), operator==(), and Sign().

◆ vchSig

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

Definition at line 102 of file governance-vote.h.

Referenced by IsValid(), and Sign().

◆ vinMasternode

CTxIn CGovernanceVote::vinMasternode
private

Definition at line 98 of file governance-vote.h.

Referenced by IsValid(), operator<(), operator==(), and Sign().


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