Dash Core  0.12.2.1
P2P Digital Currency
activemasternode.h
Go to the documentation of this file.
1 // Copyright (c) 2014-2017 The Dash Core developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef ACTIVEMASTERNODE_H
6 #define ACTIVEMASTERNODE_H
7 
8 #include "net.h"
9 #include "key.h"
10 #include "wallet/wallet.h"
11 
12 class CActiveMasternode;
13 
14 static const int ACTIVE_MASTERNODE_INITIAL = 0; // initial state
15 static const int ACTIVE_MASTERNODE_SYNC_IN_PROCESS = 1;
16 static const int ACTIVE_MASTERNODE_INPUT_TOO_NEW = 2;
17 static const int ACTIVE_MASTERNODE_NOT_CAPABLE = 3;
18 static const int ACTIVE_MASTERNODE_STARTED = 4;
19 
21 
22 // Responsible for activating the Masternode and pinging the network
24 {
25 public:
30  };
31 
32 private:
33  // critical section to protect the inner data structures
35 
37 
39 
41  bool SendMasternodePing(CConnman& connman);
42 
43  // sentinel ping data
45  uint32_t nSentinelVersion;
46 
47 public:
48  // Keys for the active Masternode
51 
52  // Initialized while registering Masternode
55 
56  int nState; // should be one of ACTIVE_MASTERNODE_XXXX
57  std::string strNotCapableReason;
58 
59 
62  fPingerEnabled(false),
64  keyMasternode(),
65  outpoint(),
66  service(),
68  {}
69 
71  void ManageState(CConnman& connman);
72 
73  std::string GetStateString() const;
74  std::string GetStatus() const;
75  std::string GetTypeString() const;
76 
77  bool UpdateSentinelPing(int version);
78 
79 private:
80  void ManageStateInitial(CConnman& connman);
81  void ManageStateRemote();
82  void ManageStateLocal(CConnman& connman);
83 };
84 
85 #endif
std::string GetStatus() const
void ManageStateInitial(CConnman &connman)
std::string GetStateString() const
void ManageStateLocal(CConnman &connman)
static const int ACTIVE_MASTERNODE_SYNC_IN_PROCESS
Definition: net.h:108
CActiveMasternode activeMasternode
bool UpdateSentinelPing(int version)
static const int ACTIVE_MASTERNODE_INITIAL
std::string GetTypeString() const
static const int ACTIVE_MASTERNODE_STARTED
version
Definition: setup.py:3
void ManageState(CConnman &connman)
Manage state of active Masternode.
std::string strNotCapableReason
static const int ACTIVE_MASTERNODE_INPUT_TOO_NEW
masternode_type_enum_t eType
Definition: pubkey.h:37
bool SendMasternodePing(CConnman &connman)
Ping Masternode.
CCriticalSection cs
Definition: key.h:35
static const int ACTIVE_MASTERNODE_NOT_CAPABLE