5 #ifndef MASTERNODEMAN_H 6 #define MASTERNODEMAN_H 29 static const int DSEG_UPDATE_SECONDS = 3 * 60 * 60;
31 static const int LAST_PAID_SCAN_BLOCKS = 100;
33 static const int MIN_POSE_PROTO_VERSION = 70203;
34 static const int MAX_POSE_CONNECTIONS = 10;
35 static const int MAX_POSE_RANK = 10;
36 static const int MAX_POSE_BLOCKS = 10;
38 static const int MNB_RECOVERY_QUORUM_TOTAL = 10;
39 static const int MNB_RECOVERY_QUORUM_REQUIRED = 6;
40 static const int MNB_RECOVERY_MAX_ASK_ENTRIES = 10;
41 static const int MNB_RECOVERY_WAIT_SECONDS = 60;
42 static const int MNB_RECOVERY_RETRY_SECONDS = 3 * 60 * 60;
81 bool GetMasternodeScores(
const uint256& nBlockHash,
score_pair_vec_t& vecMasternodeScoresRet,
int nMinProtocol = 0);
96 template <
typename Stream,
typename Operation>
97 inline void SerializationOp(Stream& s, Operation ser_action,
int nType,
int nVersion) {
99 std::string strVersion;
100 if(ser_action.ForRead()) {
104 strVersion = SERIALIZATION_VERSION_STRING;
111 READWRITE(mWeAskedForMasternodeListEntry);
119 if(ser_action.ForRead() && (strVersion != SERIALIZATION_VERSION_STRING)) {
134 bool AllowMixing(
const COutPoint &outpoint);
135 bool DisallowMixing(
const COutPoint &outpoint);
141 void CheckAndRemove(
CConnman& connman);
150 int CountMasternodes(
int nProtocolVersion = -1);
153 int CountEnabled(
int nProtocolVersion = -1);
169 bool GetNextMasternodeInQueueForPayment(
int nBlockHeight,
bool fFilterSigTime,
int& nCountRet,
masternode_info_t& mnInfoRet);
171 bool GetNextMasternodeInQueueForPayment(
bool fFilterSigTime,
int& nCountRet,
masternode_info_t& mnInfoRet);
174 masternode_info_t FindRandomNotInVec(
const std::vector<COutPoint> &vecToExclude,
int nProtocolVersion = -1);
178 bool GetMasternodeRanks(rank_pair_vec_t& vecMasternodeRanksRet,
int nBlockHeight = -1,
int nMinProtocol = 0);
179 bool GetMasternodeRank(
const COutPoint &outpoint,
int& nRankRet,
int nBlockHeight = -1,
int nMinProtocol = 0);
180 bool GetMasternodeByRank(
int nRank,
masternode_info_t& mnInfoRet,
int nBlockHeight = -1,
int nMinProtocol = 0);
182 void ProcessMasternodeConnections(
CConnman& connman);
183 std::pair<CService, std::set<uint256> > PopScheduledMnbRequestConnection();
187 void DoFullVerificationStep(
CConnman& connman);
188 void CheckSameAddr();
189 bool SendVerifyRequest(
const CAddress& addr,
const std::vector<CMasternode*>& vSortedByAddr,
CConnman& connman);
195 int size() {
return mapMasternodes.size(); }
197 std::string ToString()
const;
210 vecDirtyGovernanceObjectHashes.push_back(nHash);
216 std::vector<uint256> vecTmp = vecDirtyGovernanceObjectHashes;
217 vecDirtyGovernanceObjectHashes.clear();
221 bool IsWatchdogActive();
222 void UpdateWatchdogVoteTime(
const COutPoint& outpoint, uint64_t nVoteTime = 0);
223 bool AddGovernanceVote(
const COutPoint& outpoint,
uint256 nGovernanceObjectHash);
224 void RemoveGovernanceObject(
uint256 nGovernanceObjectHash);
226 void CheckMasternode(
const CPubKey& pubKeyMasternode,
bool fForce);
228 bool IsMasternodePingedWithin(
const COutPoint& outpoint,
int nSeconds, int64_t nTimeToCheckAt = -1);
237 void NotifyMasternodeUpdates(
CConnman& connman);
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
bool IsMnbRecoveryRequested(const uint256 &hash)
void CheckAndRemove()
This is dummy overload to be used for dumping/loading mncache.dat.
std::map< uint256, std::vector< CMasternodeBroadcast > > mMnbRecoveryGoodReplies
void AddDirtyGovernanceObjectHash(const uint256 &nHash)
std::map< uint256, CMasternodePing > mapSeenMasternodePing
std::map< COutPoint, std::map< CNetAddr, int64_t > > mWeAskedForMasternodeListEntry
std::map< uint256, std::pair< int64_t, CMasternodeBroadcast > > mapSeenMasternodeBroadcast
static bool ProcessMessage(CNode *pfrom, string strCommand, CDataStream &vRecv, int64_t nTimeReceived, CConnman &connman, std::atomic< bool > &interruptMsgProc)
std::vector< score_pair_t > score_pair_vec_t
void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman &connman)
bool fMasternodesAdded
Set when masternodes are added, cleared when CGovernanceManager is notified.
std::map< CNetAddr, int64_t > mAskedUsForMasternodeList
std::map< CNetAddr, CMasternodeVerification > mWeAskedForVerification
std::vector< uint256 > GetAndClearDirtyGovernanceObjectHashes()
std::list< std::pair< CService, uint256 > > listScheduledMnbRequestConnections
std::map< uint256, CMasternodeVerification > mapSeenMasternodeVerification
std::map< COutPoint, CMasternode > mapMasternodes
std::vector< rank_pair_t > rank_pair_vec_t
int size()
Return the number of (unique) Masternodes.
std::pair< int, CMasternode > rank_pair_t
std::map< COutPoint, CMasternode > GetFullMasternodeMap()
std::vector< uint256 > vecDirtyGovernanceObjectHashes
static const std::string SERIALIZATION_VERSION_STRING
std::map< CNetAddr, int64_t > mWeAskedForMasternodeList
int64_t nLastWatchdogVoteTime
std::pair< arith_uint256, CMasternode * > score_pair_t
std::map< uint256, std::pair< int64_t, std::set< CNetAddr > > > mMnbRecoveryRequests
bool fMasternodesRemoved
Set when masternodes are removed, cleared when CGovernanceManager is notified.