dash/src/masternode-sync.h

66 lines
1.7 KiB
C
Raw Normal View History

2015-07-15 04:44:58 +02:00
// Copyright (c) 2014-2015 The Dash developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef MASTERNODE_SYNC_H
#define MASTERNODE_SYNC_H
#define MASTERNODE_SYNC_INITIAL 0
#define MASTERNODE_SYNC_SPORKS 1
#define MASTERNODE_SYNC_LIST 2
#define MASTERNODE_SYNC_MNW 3
#define MASTERNODE_SYNC_BUDGET 4
2015-07-29 06:16:11 +02:00
#define MASTERNODE_SYNC_BUDGET_PROP 10
#define MASTERNODE_SYNC_BUDGET_FIN 11
#define MASTERNODE_SYNC_FAILED 998
#define MASTERNODE_SYNC_FINISHED 999
2015-07-15 04:44:58 +02:00
#define MASTERNODE_SYNC_TIMEOUT 7
2015-07-15 04:44:58 +02:00
class CMasternodeSync;
extern CMasternodeSync masternodeSync;
//
// CMasternodeSync : Sync masternode assets in stages
//
class CMasternodeSync
{
public:
int64_t lastMasternodeList;
int64_t lastMasternodeWinner;
int64_t lastBudgetItem;
int64_t lastFailure;
2015-07-29 06:16:11 +02:00
int nCountFailures;
// sum of all counts
int sumMasternodeList;
int sumMasternodeWinner;
int sumBudgetItemProp;
int sumBudgetItemFin;
// peers that reported counts
int countMasternodeList;
int countMasternodeWinner;
int countBudgetItemProp;
int countBudgetItemFin;
2015-07-15 04:44:58 +02:00
// Count peers we've requested the list from
int RequestedMasternodeAssets;
int RequestedMasternodeAttempt;
CMasternodeSync();
void AddedMasternodeList();
void AddedMasternodeWinner();
void AddedBudgetItem();
void GetNextAsset();
2015-07-29 06:16:11 +02:00
void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
bool IsBudgetFinEmpty();
2015-07-15 04:44:58 +02:00
void Process();
bool IsSynced();
bool IsBlockchainSynced();
2015-07-15 04:44:58 +02:00
};
#endif