mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 21:42:47 +01:00
8f9544c46e
8ee7b8a
Move broadcast creation to CMasternodeBroadcast
60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-2012 The Bitcoin developers
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
#ifndef ACTIVEMASTERNODE_H
|
|
#define ACTIVEMASTERNODE_H
|
|
|
|
#include "sync.h"
|
|
#include "net.h"
|
|
#include "key.h"
|
|
#include "init.h"
|
|
#include "wallet/wallet.h"
|
|
#include "darksend.h"
|
|
#include "masternode.h"
|
|
|
|
#define ACTIVE_MASTERNODE_INITIAL 0 // initial state
|
|
#define ACTIVE_MASTERNODE_SYNC_IN_PROCESS 1
|
|
#define ACTIVE_MASTERNODE_INPUT_TOO_NEW 2
|
|
#define ACTIVE_MASTERNODE_NOT_CAPABLE 3
|
|
#define ACTIVE_MASTERNODE_STARTED 4
|
|
|
|
// Responsible for activating the Masternode and pinging the network
|
|
class CActiveMasternode
|
|
{
|
|
private:
|
|
// critical section to protect the inner data structures
|
|
mutable CCriticalSection cs;
|
|
|
|
/// Ping Masternode
|
|
bool SendMasternodePing(std::string& errorMessage);
|
|
|
|
public:
|
|
// Initialized by init.cpp
|
|
// Keys for the main Masternode
|
|
CPubKey pubKeyMasternode;
|
|
CKey keyMasternode;
|
|
|
|
// Initialized while registering Masternode
|
|
CTxIn vin;
|
|
CService service;
|
|
|
|
int status;
|
|
std::string notCapableReason;
|
|
|
|
CActiveMasternode()
|
|
{
|
|
status = ACTIVE_MASTERNODE_INITIAL;
|
|
}
|
|
|
|
/// Manage status of main Masternode
|
|
void ManageStatus();
|
|
std::string GetStatus();
|
|
|
|
|
|
/// Enable cold wallet mode (run a Masternode with no funds)
|
|
bool EnableHotColdMasterNode(CTxIn& vin, CService& addr);
|
|
};
|
|
|
|
#endif
|