2014-12-09 02:17:57 +01:00
|
|
|
// 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 "bignum.h"
|
|
|
|
#include "sync.h"
|
|
|
|
#include "net.h"
|
|
|
|
#include "key.h"
|
|
|
|
#include "core.h"
|
|
|
|
#include "init.h"
|
|
|
|
#include "wallet.h"
|
|
|
|
#include "darksend.h"
|
|
|
|
|
2015-03-05 09:10:15 +01:00
|
|
|
// Responsible for activating the Masternode and pinging the network
|
2014-12-09 02:17:57 +01:00
|
|
|
class CActiveMasternode
|
|
|
|
{
|
|
|
|
public:
|
2014-12-06 20:41:53 +01:00
|
|
|
// Initialized by init.cpp
|
2015-03-05 09:10:15 +01:00
|
|
|
// Keys for the main Masternode
|
2014-12-06 20:41:53 +01:00
|
|
|
CPubKey pubKeyMasternode;
|
2014-12-09 02:17:57 +01:00
|
|
|
|
2015-03-05 09:10:15 +01:00
|
|
|
// Initialized while registering Masternode
|
2014-12-06 20:41:53 +01:00
|
|
|
CTxIn vin;
|
|
|
|
CService service;
|
2014-12-09 02:17:57 +01:00
|
|
|
|
2014-12-06 20:41:53 +01:00
|
|
|
int status;
|
|
|
|
std::string notCapableReason;
|
2014-12-09 02:17:57 +01:00
|
|
|
|
|
|
|
CActiveMasternode()
|
2014-12-06 20:41:53 +01:00
|
|
|
{
|
|
|
|
status = MASTERNODE_NOT_PROCESSED;
|
2014-12-09 02:17:57 +01:00
|
|
|
}
|
|
|
|
|
2015-03-05 09:10:15 +01:00
|
|
|
/// Manage status of main Masternode
|
|
|
|
void ManageStatus();
|
2014-12-06 20:41:53 +01:00
|
|
|
|
2015-03-05 09:10:15 +01:00
|
|
|
/// Ping for main Masternode
|
|
|
|
bool Dseep(std::string& errorMessage);
|
|
|
|
/// Ping for any Masternode
|
|
|
|
bool Dseep(CTxIn vin, CService service, CKey key, CPubKey pubKey, std::string &retErrorMessage, bool stop);
|
2014-12-06 20:41:53 +01:00
|
|
|
|
2015-03-05 09:10:15 +01:00
|
|
|
/// Stop main Masternode
|
|
|
|
bool StopMasterNode(std::string& errorMessage);
|
|
|
|
/// Stop remote Masternode
|
|
|
|
bool StopMasterNode(std::string strService, std::string strKeyMasternode, std::string& errorMessage);
|
|
|
|
/// Stop any Masternode
|
|
|
|
bool StopMasterNode(CTxIn vin, CService service, CKey key, CPubKey pubKey, std::string& errorMessage);
|
2014-12-06 20:41:53 +01:00
|
|
|
|
2015-03-05 09:10:15 +01:00
|
|
|
/// Register remote Masternode
|
2015-03-16 20:01:11 +01:00
|
|
|
bool Register(std::string strService, std::string strKey, std::string txHash, std::string strOutputIndex, std::string strDonationAddress, std::string strDonationPercentage, std::string& errorMessage);
|
2015-03-05 09:10:15 +01:00
|
|
|
/// Register any Masternode
|
2015-03-16 20:01:11 +01:00
|
|
|
bool Register(CTxIn vin, CService service, CKey key, CPubKey pubKey, CKey keyMasternode, CPubKey pubKeyMasternode, CScript donationAddress, int donationPercentage, std::string &retErrorMessage);
|
2014-12-06 20:41:53 +01:00
|
|
|
|
2015-03-05 09:10:15 +01:00
|
|
|
/// Get 1000DRK input that can be used for the Masternode
|
2014-12-09 02:17:57 +01:00
|
|
|
bool GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey);
|
2014-12-06 20:41:53 +01:00
|
|
|
bool GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey, std::string strTxHash, std::string strOutputIndex);
|
|
|
|
vector<COutput> SelectCoinsMasternode();
|
|
|
|
bool GetVinFromOutput(COutput out, CTxIn& vin, CPubKey& pubkey, CKey& secretKey);
|
2014-12-09 02:17:57 +01:00
|
|
|
|
2015-03-05 09:10:15 +01:00
|
|
|
/// Enable hot wallet mode (run a Masternode with no funds)
|
2014-12-06 20:41:53 +01:00
|
|
|
bool EnableHotColdMasterNode(CTxIn& vin, CService& addr);
|
2014-12-09 02:17:57 +01:00
|
|
|
};
|
|
|
|
|
2014-12-06 20:41:53 +01:00
|
|
|
#endif
|