72 int64_t nMin = numeric_limits<int64_t>::max();
129 return double(nCount) / double(nMax - nMin);
134 template <
typename Stream,
typename Operation>
161 template <
typename Stream,
typename Operation>
183 typedef std::map<uint256, CGovernanceVote>
vote_m_t;
195 typedef std::map<COutPoint, last_object_rec >
txout_m_t;
312 std::vector<CGovernanceObject*>
GetAllNewerThan(int64_t nMoreThanTime);
327 LogPrint(
"gobject",
"Governance object manager was cleared\n");
343 template <
typename Stream,
typename Operation>
344 inline void SerializationOp(Stream& s, Operation ser_action,
int nType,
int nVersion) {
346 std::string strVersion;
347 if(ser_action.ForRead()) {
403 bool fOK =
ProcessVote(NULL, vote, exception, connman);
std::vector< CGovernanceObject * > GetAllNewerThan(int64_t nMoreThanTime)
static const std::string SERIALIZATION_VERSION_STRING
bool IsBudgetPaymentBlock(int nBlockHeight)
int RequestGovernanceObjectVotes(CNode *pnode, CConnman &connman)
bool AreRateChecksEnabled() const
static const int RATE_BUFFER_SIZE
void AddSeenGovernanceObject(uint256 nHash, int status)
hash_time_m_t mapErasedGovernanceObjects
bool AcceptObjectMessage(const uint256 &nHash)
Called to indicate a requested object has been received.
bool ProcessVoteAndRelay(const CGovernanceVote &vote, CGovernanceException &exception, CConnman &connman)
void AddOrphanVote(const CGovernanceVote &vote)
void AddSeenVote(uint256 nHash, int status)
object_info_m_t mapMasternodeOrphanObjects
static const int64_t GOVERNANCE_ORPHAN_EXPIRATION_TIME
object_info_m_t::iterator object_info_m_it
std::map< uint256, CGovernanceVote > vote_m_t
bool Insert(const K &key, const V &value)
std::pair< CGovernanceVote, int64_t > vote_time_pair_t
static const int MAX_CACHE_SIZE
void CheckOrphanVotes(CGovernanceObject &govobj, CGovernanceException &exception, CConnman &connman)
bool HaveObjectForHash(uint256 nHash)
hash_s_t::iterator hash_s_it
void RequestOrphanObjects(CConnman &connman)
hash_time_m_t::const_iterator hash_time_m_cit
virtual ~CGovernanceManager()
std::vector< CGovernanceVote > GetCurrentVotes(const uint256 &nParentHash, const COutPoint &mnCollateralOutpointFilter)
vote_mcache_t mapOrphanVotes
CGovernanceObject * FindGovernanceObject(const uint256 &nHash)
std::vector< CGovernanceVote > GetMatchingVotes(const uint256 &nParentHash)
txout_m_t::iterator txout_m_it
std::pair< CGovernanceObject, ExpirationInfo > object_info_pair_t
hash_s_t setRequestedVotes
last_object_rec(bool fStatusOKIn=true)
hash_s_t setRequestedObjects
void CheckPostponedObjects(CConnman &connman)
object_ref_cache_t mapVoteToObject
bool ProcessVote(CNode *pfrom, const CGovernanceVote &vote, CGovernanceException &exception, CConnman &connman)
bool SerializeVoteForHash(uint256 nHash, CDataStream &ss)
int64_t nTimeWatchdogCurrent
void ProcessMessage(CNode *pfrom, std::string &strCommand, CDataStream &vRecv, CConnman &connman)
hash_time_m_t mapWatchdogObjects
void UpdateLastDiffTime(int64_t nTimeIn)
void CleanOrphanObjects()
int64_t GetMaxTimestamp()
txout_m_t::const_iterator txout_m_cit
void RequestGovernanceObject(CNode *pfrom, const uint256 &nHash, CConnman &connman, bool fUseFilter=false)
bool ConfirmInventoryRequest(const CInv &inv)
#define AssertLockHeld(cs)
uint256 nHashWatchdogCurrent
CGovernanceManager governance
bool MasternodeRateCheck(const CGovernanceObject &govobj, bool fUpdateFailStatus=false)
static const int RELIABLE_PROPAGATION_TIME
bool AcceptVoteMessage(const uint256 &nHash)
Called to indicate a requested vote has been received.
object_m_t::iterator object_m_it
hash_s_t setAdditionalRelayObjects
void Insert(const K &key, const V &value)
static int LogPrint(const char *category, const char *format)
object_m_t::size_type size_type
void AddTimestamp(int64_t nTimestamp)
vote_m_t::iterator vote_m_it
static const int MAX_TIME_FUTURE_DEVIATION
void AddPostponedObject(const CGovernanceObject &govobj)
void UpdatedBlockTip(const CBlockIndex *pindex, CConnman &connman)
void Sync(CNode *node, const uint256 &nProp, const CBloomFilter &filter, CConnman &connman)
bool SerializeObjectForHash(uint256 nHash, CDataStream &ss)
CacheMap< uint256, CGovernanceVote > vote_cache_t
CacheMap< uint256, CGovernanceObject * > object_ref_cache_t
static bool AcceptMessage(const uint256 &nHash, hash_s_t &setHash)
bool UpdateCurrentWatchdog(CGovernanceObject &watchdogNew)
void DoMaintenance(CConnman &connman)
std::map< uint256, object_info_pair_t > object_info_m_t
std::set< uint256 > hash_s_t
void UpdateCachesAndClean()
void MasternodeRateUpdate(const CGovernanceObject &govobj)
void AddInvalidVote(const CGovernanceVote &vote)
std::map< COutPoint, int > txout_int_m_t
CRateCheckBuffer triggerBuffer
CacheMultiMap< uint256, vote_time_pair_t > vote_mcache_t
std::map< COutPoint, last_object_rec > txout_m_t
void CheckMasternodeOrphanObjects(CConnman &connman)
void CheckMasternodeOrphanVotes(CConnman &connman)
std::string GetRequiredPaymentsString(int nBlockHeight)
int64_t GetMinTimestamp()
txout_m_t mapLastMasternodeObject
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
ExpirationInfo(int64_t _nExpirationTime, int _idFrom)
int64_t GetAdjustedTime()
std::vector< int64_t > vecTimestamps
vote_cache_t mapInvalidVotes
hash_s_t::const_iterator hash_s_cit
int GetCachedBlockHeight()
object_m_t::const_iterator object_m_cit
txout_int_m_t mapMasternodeOrphanCounter
ScopedLockBool(CCriticalSection &_cs, bool &_ref, bool _value)
bool HaveVoteForHash(uint256 nHash)
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
virtual uint256 GetHash()=0
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
object_info_m_t::const_iterator object_info_m_cit
std::map< uint256, CGovernanceObject > object_m_t
void AddGovernanceObject(CGovernanceObject &govobj, CConnman &connman, CNode *pfrom=NULL)
void Relay(CConnman &connman) const
vote_m_t::const_iterator vote_m_cit
CRateCheckBuffer watchdogBuffer
hash_time_m_t::iterator hash_time_m_it
std::map< uint256, int64_t > hash_time_m_t
std::string ToString() const
int64_t GetLastDiffTime()
object_m_t mapPostponedObjects