![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include <governance.h>
Classes | |
struct | last_object_rec |
class | ScopedLockBool |
Public Types | |
typedef std::map< uint256, CGovernanceObject > | object_m_t |
typedef object_m_t::iterator | object_m_it |
typedef object_m_t::const_iterator | object_m_cit |
typedef CacheMap< uint256, CGovernanceObject * > | object_ref_cache_t |
typedef std::map< uint256, CGovernanceVote > | vote_m_t |
typedef vote_m_t::iterator | vote_m_it |
typedef vote_m_t::const_iterator | vote_m_cit |
typedef CacheMap< uint256, CGovernanceVote > | vote_cache_t |
typedef CacheMultiMap< uint256, vote_time_pair_t > | vote_mcache_t |
typedef object_m_t::size_type | size_type |
typedef std::map< COutPoint, last_object_rec > | txout_m_t |
typedef txout_m_t::iterator | txout_m_it |
typedef txout_m_t::const_iterator | txout_m_cit |
typedef std::map< COutPoint, int > | txout_int_m_t |
typedef std::set< uint256 > | hash_s_t |
typedef hash_s_t::iterator | hash_s_it |
typedef hash_s_t::const_iterator | hash_s_cit |
typedef std::map< uint256, object_info_pair_t > | object_info_m_t |
typedef object_info_m_t::iterator | object_info_m_it |
typedef object_info_m_t::const_iterator | object_info_m_cit |
typedef std::map< uint256, int64_t > | hash_time_m_t |
typedef hash_time_m_t::iterator | hash_time_m_it |
typedef hash_time_m_t::const_iterator | hash_time_m_cit |
Public Member Functions | |
CGovernanceManager () | |
virtual | ~CGovernanceManager () |
bool | ConfirmInventoryRequest (const CInv &inv) |
void | Sync (CNode *node, const uint256 &nProp, const CBloomFilter &filter, CConnman &connman) |
void | ProcessMessage (CNode *pfrom, std::string &strCommand, CDataStream &vRecv, CConnman &connman) |
void | DoMaintenance (CConnman &connman) |
CGovernanceObject * | FindGovernanceObject (const uint256 &nHash) |
std::vector< CGovernanceVote > | GetMatchingVotes (const uint256 &nParentHash) |
std::vector< CGovernanceVote > | GetCurrentVotes (const uint256 &nParentHash, const COutPoint &mnCollateralOutpointFilter) |
std::vector< CGovernanceObject * > | GetAllNewerThan (int64_t nMoreThanTime) |
bool | IsBudgetPaymentBlock (int nBlockHeight) |
void | AddGovernanceObject (CGovernanceObject &govobj, CConnman &connman, CNode *pfrom=NULL) |
std::string | GetRequiredPaymentsString (int nBlockHeight) |
void | UpdateCachesAndClean () |
void | CheckAndRemove () |
void | Clear () |
std::string | ToString () const |
template<typename Stream , typename Operation > | |
void | SerializationOp (Stream &s, Operation ser_action, int nType, int nVersion) |
void | UpdatedBlockTip (const CBlockIndex *pindex, CConnman &connman) |
int64_t | GetLastDiffTime () |
void | UpdateLastDiffTime (int64_t nTimeIn) |
int | GetCachedBlockHeight () |
bool | HaveObjectForHash (uint256 nHash) |
bool | HaveVoteForHash (uint256 nHash) |
int | GetVoteCount () const |
bool | SerializeObjectForHash (uint256 nHash, CDataStream &ss) |
bool | SerializeVoteForHash (uint256 nHash, CDataStream &ss) |
void | AddPostponedObject (const CGovernanceObject &govobj) |
void | AddSeenGovernanceObject (uint256 nHash, int status) |
void | AddSeenVote (uint256 nHash, int status) |
void | MasternodeRateUpdate (const CGovernanceObject &govobj) |
bool | MasternodeRateCheck (const CGovernanceObject &govobj, bool fUpdateFailStatus=false) |
bool | MasternodeRateCheck (const CGovernanceObject &govobj, bool fUpdateFailStatus, bool fForce, bool &fRateCheckBypassed) |
bool | ProcessVoteAndRelay (const CGovernanceVote &vote, CGovernanceException &exception, CConnman &connman) |
void | CheckMasternodeOrphanVotes (CConnman &connman) |
void | CheckMasternodeOrphanObjects (CConnman &connman) |
void | CheckPostponedObjects (CConnman &connman) |
bool | AreRateChecksEnabled () const |
void | InitOnLoad () |
int | RequestGovernanceObjectVotes (CNode *pnode, CConnman &connman) |
int | RequestGovernanceObjectVotes (const std::vector< CNode *> &vNodesCopy, CConnman &connman) |
Public Attributes | |
CCriticalSection | cs |
ADD_SERIALIZE_METHODS | |
Private Member Functions | |
void | RequestGovernanceObject (CNode *pfrom, const uint256 &nHash, CConnman &connman, bool fUseFilter=false) |
void | AddInvalidVote (const CGovernanceVote &vote) |
void | AddOrphanVote (const CGovernanceVote &vote) |
bool | ProcessVote (CNode *pfrom, const CGovernanceVote &vote, CGovernanceException &exception, CConnman &connman) |
bool | AcceptObjectMessage (const uint256 &nHash) |
Called to indicate a requested object has been received. More... | |
bool | AcceptVoteMessage (const uint256 &nHash) |
Called to indicate a requested vote has been received. More... | |
void | CheckOrphanVotes (CGovernanceObject &govobj, CGovernanceException &exception, CConnman &connman) |
void | RebuildIndexes () |
void | AddCachedTriggers () |
bool | UpdateCurrentWatchdog (CGovernanceObject &watchdogNew) |
void | RequestOrphanObjects (CConnman &connman) |
void | CleanOrphanObjects () |
Static Private Member Functions | |
static bool | AcceptMessage (const uint256 &nHash, hash_s_t &setHash) |
Static Private Attributes | |
static const int | MAX_CACHE_SIZE = 1000000 |
static const std::string | SERIALIZATION_VERSION_STRING = "CGovernanceManager-Version-12" |
static const int | MAX_TIME_FUTURE_DEVIATION = 60*60 |
static const int | RELIABLE_PROPAGATION_TIME = 60 |
Friends | |
class | CGovernanceObject |
Definition at line 147 of file governance.h.
typedef hash_s_t::const_iterator CGovernanceManager::hash_s_cit |
Definition at line 207 of file governance.h.
typedef hash_s_t::iterator CGovernanceManager::hash_s_it |
Definition at line 205 of file governance.h.
typedef std::set<uint256> CGovernanceManager::hash_s_t |
Definition at line 203 of file governance.h.
typedef hash_time_m_t::const_iterator CGovernanceManager::hash_time_m_cit |
Definition at line 219 of file governance.h.
typedef hash_time_m_t::iterator CGovernanceManager::hash_time_m_it |
Definition at line 217 of file governance.h.
typedef std::map<uint256, int64_t> CGovernanceManager::hash_time_m_t |
Definition at line 215 of file governance.h.
typedef object_info_m_t::const_iterator CGovernanceManager::object_info_m_cit |
Definition at line 213 of file governance.h.
typedef object_info_m_t::iterator CGovernanceManager::object_info_m_it |
Definition at line 211 of file governance.h.
typedef std::map<uint256, object_info_pair_t> CGovernanceManager::object_info_m_t |
Definition at line 209 of file governance.h.
typedef object_m_t::const_iterator CGovernanceManager::object_m_cit |
Definition at line 179 of file governance.h.
typedef object_m_t::iterator CGovernanceManager::object_m_it |
Definition at line 177 of file governance.h.
typedef std::map<uint256, CGovernanceObject> CGovernanceManager::object_m_t |
Definition at line 175 of file governance.h.
Definition at line 181 of file governance.h.
typedef object_m_t::size_type CGovernanceManager::size_type |
Definition at line 193 of file governance.h.
typedef std::map<COutPoint, int> CGovernanceManager::txout_int_m_t |
Definition at line 201 of file governance.h.
typedef txout_m_t::const_iterator CGovernanceManager::txout_m_cit |
Definition at line 199 of file governance.h.
typedef txout_m_t::iterator CGovernanceManager::txout_m_it |
Definition at line 197 of file governance.h.
typedef std::map<COutPoint, last_object_rec > CGovernanceManager::txout_m_t |
Definition at line 195 of file governance.h.
Definition at line 189 of file governance.h.
typedef vote_m_t::const_iterator CGovernanceManager::vote_m_cit |
Definition at line 187 of file governance.h.
typedef vote_m_t::iterator CGovernanceManager::vote_m_it |
Definition at line 185 of file governance.h.
typedef std::map<uint256, CGovernanceVote> CGovernanceManager::vote_m_t |
Definition at line 183 of file governance.h.
Definition at line 191 of file governance.h.
CGovernanceManager::CGovernanceManager | ( | ) |
Definition at line 25 of file governance.cpp.
|
inlinevirtual |
Definition at line 293 of file governance.h.
Definition at line 1257 of file governance.cpp.
Referenced by AcceptObjectMessage(), and AcceptVoteMessage().
|
private |
Called to indicate a requested object has been received.
Definition at line 1245 of file governance.cpp.
Referenced by ProcessMessage().
|
private |
Called to indicate a requested vote has been received.
Definition at line 1251 of file governance.cpp.
Referenced by ProcessMessage().
|
private |
Definition at line 1281 of file governance.cpp.
Referenced by InitOnLoad().
void CGovernanceManager::AddGovernanceObject | ( | CGovernanceObject & | govobj, |
CConnman & | connman, | ||
CNode * | pfrom = NULL |
||
) |
Definition at line 301 of file governance.cpp.
Referenced by CheckMasternodeOrphanObjects(), CheckPostponedObjects(), gobject(), and ProcessMessage().
|
inlineprivate |
Definition at line 429 of file governance.h.
Referenced by CGovernanceObject::ProcessVote().
|
inlineprivate |
Definition at line 434 of file governance.h.
|
inline |
Definition at line 386 of file governance.h.
Referenced by gobject(), and ProcessMessage().
void CGovernanceManager::AddSeenGovernanceObject | ( | uint256 | nHash, |
int | status | ||
) |
void CGovernanceManager::AddSeenVote | ( | uint256 | nHash, |
int | status | ||
) |
|
inline |
Definition at line 416 of file governance.h.
Referenced by CGovernanceObject::ProcessVote().
|
inline |
Definition at line 321 of file governance.h.
void CGovernanceManager::CheckMasternodeOrphanObjects | ( | CConnman & | connman | ) |
Definition at line 996 of file governance.cpp.
Referenced by CMasternodeMan::NotifyMasternodeUpdates().
void CGovernanceManager::CheckMasternodeOrphanVotes | ( | CConnman & | connman | ) |
Definition at line 985 of file governance.cpp.
Referenced by CMasternodeMan::NotifyMasternodeUpdates().
|
private |
Definition at line 274 of file governance.cpp.
Referenced by AddGovernanceObject().
void CGovernanceManager::CheckPostponedObjects | ( | CConnman & | connman | ) |
Definition at line 1031 of file governance.cpp.
Referenced by UpdatedBlockTip().
|
private |
Definition at line 1391 of file governance.cpp.
Referenced by DoMaintenance().
|
inline |
Definition at line 323 of file governance.h.
Referenced by SerializationOp().
bool CGovernanceManager::ConfirmInventoryRequest | ( | const CInv & | inv | ) |
This is called by AlreadyHave in main.cpp as part of the inventory retrieval process. Returns true if we want to retrieve the object, otherwise false. (Note logic is inverted in AlreadyHave).
Definition at line 678 of file governance.cpp.
Referenced by AlreadyHave().
void CGovernanceManager::DoMaintenance | ( | CConnman & | connman | ) |
Definition at line 663 of file governance.cpp.
Referenced by ThreadCheckPrivateSend().
CGovernanceObject * CGovernanceManager::FindGovernanceObject | ( | const uint256 & | nHash | ) |
Definition at line 559 of file governance.cpp.
Referenced by CGovernanceTriggerManager::CleanAndRemove(), CGovernanceTriggerManager::GetActiveTriggers(), CSuperblock::GetGovernanceObject(), gobject(), and RequestGovernanceObject().
std::vector< CGovernanceObject * > CGovernanceManager::GetAllNewerThan | ( | int64_t | nMoreThanTime | ) |
Definition at line 623 of file governance.cpp.
Referenced by gobject().
|
inline |
Definition at line 373 of file governance.h.
Referenced by CGovernanceTriggerManager::CleanAndRemove().
std::vector< CGovernanceVote > CGovernanceManager::GetCurrentVotes | ( | const uint256 & | nParentHash, |
const COutPoint & | mnCollateralOutpointFilter | ||
) |
Definition at line 583 of file governance.cpp.
Referenced by gobject().
|
inline |
Definition at line 370 of file governance.h.
Referenced by gobject().
std::vector< CGovernanceVote > CGovernanceManager::GetMatchingVotes | ( | const uint256 & | nParentHash | ) |
Definition at line 569 of file governance.cpp.
Referenced by gobject().
std::string CGovernanceManager::GetRequiredPaymentsString | ( | int | nBlockHeight | ) |
int CGovernanceManager::GetVoteCount | ( | ) | const |
Definition at line 77 of file governance.cpp.
Referenced by CMasternodeSync::ProcessTick().
bool CGovernanceManager::HaveObjectForHash | ( | uint256 | nHash | ) |
Definition at line 44 of file governance.cpp.
Referenced by ProcessGetData().
bool CGovernanceManager::HaveVoteForHash | ( | uint256 | nHash | ) |
Definition at line 62 of file governance.cpp.
Referenced by ProcessGetData().
void CGovernanceManager::InitOnLoad | ( | ) |
Definition at line 1296 of file governance.cpp.
Referenced by AppInit2().
bool CGovernanceManager::IsBudgetPaymentBlock | ( | int | nBlockHeight | ) |
bool CGovernanceManager::MasternodeRateCheck | ( | const CGovernanceObject & | govobj, |
bool | fUpdateFailStatus = false |
||
) |
Definition at line 842 of file governance.cpp.
Referenced by gobject(), and ProcessMessage().
bool CGovernanceManager::MasternodeRateCheck | ( | const CGovernanceObject & | govobj, |
bool | fUpdateFailStatus, | ||
bool | fForce, | ||
bool & | fRateCheckBypassed | ||
) |
Definition at line 848 of file governance.cpp.
void CGovernanceManager::MasternodeRateUpdate | ( | const CGovernanceObject & | govobj | ) |
Definition at line 816 of file governance.cpp.
Referenced by AddGovernanceObject().
void CGovernanceManager::ProcessMessage | ( | CNode * | pfrom, |
std::string & | strCommand, | ||
CDataStream & | vRecv, | ||
CConnman & | connman | ||
) |
Definition at line 101 of file governance.cpp.
Referenced by ProcessMessage().
|
private |
Definition at line 929 of file governance.cpp.
Referenced by ProcessMessage(), and ProcessVoteAndRelay().
|
inline |
Definition at line 402 of file governance.h.
|
private |
Definition at line 1269 of file governance.cpp.
Referenced by InitOnLoad().
|
private |
Definition at line 1100 of file governance.cpp.
Referenced by ProcessVote(), RequestGovernanceObjectVotes(), and RequestOrphanObjects().
Definition at line 1135 of file governance.cpp.
Referenced by CMasternodeSync::ProcessTick().
int CGovernanceManager::RequestGovernanceObjectVotes | ( | const std::vector< CNode *> & | vNodesCopy, |
CConnman & | connman | ||
) |
Definition at line 1143 of file governance.cpp.
|
private |
Definition at line 1359 of file governance.cpp.
Referenced by DoMaintenance().
|
inline |
Definition at line 344 of file governance.h.
bool CGovernanceManager::SerializeObjectForHash | ( | uint256 | nHash, |
CDataStream & | ss | ||
) |
Definition at line 49 of file governance.cpp.
Referenced by ProcessGetData().
bool CGovernanceManager::SerializeVoteForHash | ( | uint256 | nHash, |
CDataStream & | ss | ||
) |
Definition at line 83 of file governance.cpp.
Referenced by ProcessGetData().
void CGovernanceManager::Sync | ( | CNode * | node, |
const uint256 & | nProp, | ||
const CBloomFilter & | filter, | ||
CConnman & | connman | ||
) |
Definition at line 733 of file governance.cpp.
Referenced by ProcessMessage().
std::string CGovernanceManager::ToString | ( | ) | const |
Definition at line 1307 of file governance.cpp.
Referenced by gobject(), InitOnLoad(), UpdateCachesAndClean(), and UpdateCurrentWatchdog().
void CGovernanceManager::UpdateCachesAndClean | ( | ) |
Definition at line 425 of file governance.cpp.
Referenced by CheckAndRemove(), DoMaintenance(), and CMasternodeMan::NotifyMasternodeUpdates().
|
private |
Definition at line 391 of file governance.cpp.
Referenced by AddGovernanceObject().
void CGovernanceManager::UpdatedBlockTip | ( | const CBlockIndex * | pindex, |
CConnman & | connman | ||
) |
Definition at line 1342 of file governance.cpp.
Referenced by CDSNotificationInterface::UpdatedBlockTip().
|
inline |
Definition at line 371 of file governance.h.
Referenced by gobject().
|
friend |
Definition at line 149 of file governance.h.
CGovernanceManager::ADD_SERIALIZE_METHODS |
Definition at line 341 of file governance.h.
|
mutable |
Definition at line 289 of file governance.h.
Referenced by AcceptObjectMessage(), AcceptVoteMessage(), AddCachedTriggers(), AddGovernanceObject(), CGovernanceTriggerManager::AddNewTrigger(), AddPostponedObject(), AreRateChecksEnabled(), CheckMasternodeOrphanObjects(), CheckMasternodeOrphanVotes(), CheckOrphanVotes(), CheckPostponedObjects(), CGovernanceTriggerManager::CleanAndRemove(), CleanOrphanObjects(), Clear(), ConfirmInventoryRequest(), CSuperblockManager::CreateSuperblock(), FindGovernanceObject(), CGovernanceTriggerManager::GetActiveTriggers(), GetAllNewerThan(), CSuperblockManager::GetBestSuperblock(), GetCurrentVotes(), CSuperblock::GetGovernanceObject(), GetMatchingVotes(), CSuperblockManager::GetRequiredPaymentsString(), GetVoteCount(), gobject(), HaveObjectForHash(), HaveVoteForHash(), InitOnLoad(), CSuperblockManager::IsSuperblockTriggered(), CSuperblockManager::IsValid(), MasternodeRateCheck(), ProcessMessage(), ProcessVote(), RequestGovernanceObject(), RequestGovernanceObjectVotes(), RequestOrphanObjects(), SerializationOp(), SerializeObjectForHash(), SerializeVoteForHash(), Sync(), ToString(), UpdateCachesAndClean(), and UpdateCurrentWatchdog().
|
private |
Definition at line 266 of file governance.h.
Referenced by AreRateChecksEnabled(), CheckMasternodeOrphanObjects(), CheckMasternodeOrphanVotes(), CheckOrphanVotes(), MasternodeRateCheck(), and UpdateCachesAndClean().
|
private |
Definition at line 240 of file governance.h.
Referenced by Clear(), ProcessMessage(), SerializationOp(), ToString(), and UpdateCachesAndClean().
|
private |
Definition at line 256 of file governance.h.
Referenced by AddInvalidVote(), Clear(), ProcessVote(), and SerializationOp().
|
private |
Definition at line 260 of file governance.h.
Referenced by Clear(), MasternodeRateCheck(), MasternodeRateUpdate(), and SerializationOp().
|
private |
Definition at line 243 of file governance.h.
Referenced by CheckMasternodeOrphanObjects(), and ProcessMessage().
|
private |
Definition at line 242 of file governance.h.
Referenced by CheckMasternodeOrphanObjects(), and ProcessMessage().
|
private |
Definition at line 235 of file governance.h.
Referenced by AddCachedTriggers(), AddGovernanceObject(), CheckMasternodeOrphanVotes(), CheckPostponedObjects(), Clear(), ConfirmInventoryRequest(), FindGovernanceObject(), GetAllNewerThan(), GetCurrentVotes(), GetMatchingVotes(), HaveObjectForHash(), ProcessMessage(), ProcessVote(), RebuildIndexes(), RequestGovernanceObjectVotes(), RequestOrphanObjects(), SerializationOp(), SerializeObjectForHash(), Sync(), ToString(), UpdateCachesAndClean(), and UpdateCurrentWatchdog().
|
private |
Definition at line 258 of file governance.h.
Referenced by AddOrphanVote(), CheckOrphanVotes(), CleanOrphanObjects(), Clear(), ProcessVote(), RequestOrphanObjects(), and SerializationOp().
|
private |
Definition at line 245 of file governance.h.
Referenced by AddPostponedObject(), CheckPostponedObjects(), ConfirmInventoryRequest(), HaveObjectForHash(), ProcessMessage(), and SerializeObjectForHash().
|
private |
Definition at line 254 of file governance.h.
Referenced by Clear(), ConfirmInventoryRequest(), GetVoteCount(), HaveVoteForHash(), ProcessVote(), RebuildIndexes(), SerializeVoteForHash(), ToString(), and UpdateCachesAndClean().
|
private |
Definition at line 248 of file governance.h.
Referenced by AddGovernanceObject(), Clear(), SerializationOp(), ToString(), and UpdateCachesAndClean().
|
staticprivate |
Definition at line 222 of file governance.h.
|
staticprivate |
Definition at line 226 of file governance.h.
Referenced by CheckPostponedObjects(), MasternodeRateCheck(), and MasternodeRateUpdate().
|
private |
Definition at line 232 of file governance.h.
Referenced by AddGovernanceObject(), GetCachedBlockHeight(), ProcessMessage(), and UpdatedBlockTip().
|
private |
Definition at line 250 of file governance.h.
Referenced by AddGovernanceObject(), Clear(), SerializationOp(), UpdateCachesAndClean(), and UpdateCurrentWatchdog().
|
private |
Definition at line 229 of file governance.h.
Referenced by GetLastDiffTime(), and UpdateLastDiffTime().
|
private |
Definition at line 252 of file governance.h.
Referenced by Clear(), SerializationOp(), and UpdateCurrentWatchdog().
|
staticprivate |
Definition at line 227 of file governance.h.
Referenced by CheckPostponedObjects(), and MasternodeRateUpdate().
|
staticprivate |
Definition at line 224 of file governance.h.
Referenced by SerializationOp().
|
private |
Definition at line 246 of file governance.h.
Referenced by CheckPostponedObjects(), and MasternodeRateUpdate().
|
private |
Definition at line 262 of file governance.h.
Referenced by AcceptObjectMessage(), and ConfirmInventoryRequest().
|
private |
Definition at line 264 of file governance.h.
Referenced by AcceptVoteMessage(), and ConfirmInventoryRequest().