Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.11.2 comments #226

Merged
merged 3 commits into from
Mar 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <boost/lexical_cast.hpp>

//
// Bootup the masternode, look for a 1000DRK input and register on the network
// Bootup the Masternode, look for a 1000DRK input and register on the network
//
void CActiveMasternode::ManageStatus()
{
Expand All @@ -20,7 +20,7 @@ void CActiveMasternode::ManageStatus()
bool fIsInitialDownload = IsInitialBlockDownload();
if(fIsInitialDownload) {
status = MASTERNODE_SYNC_IN_PROCESS;
LogPrintf("CActiveMasternode::ManageStatus() - Sync in progress. Must wait until sync is complete to start masternode.\n");
LogPrintf("CActiveMasternode::ManageStatus() - Sync in progress. Must wait until sync is complete to start Masternode.\n");
return;
}

Expand All @@ -31,7 +31,7 @@ void CActiveMasternode::ManageStatus()
if(status == MASTERNODE_NOT_PROCESSED) {
if(strMasterNodeAddr.empty()) {
if(!GetLocal(service)) {
notCapableReason = "Can't detect external address. Please use the masternodeaddr configuration option.";
notCapableReason = "Can't detect external address. Please use the Masternodeaddr configuration option.";
status = MASTERNODE_NOT_CAPABLE;
LogPrintf("CActiveMasternode::ManageStatus() - not capable: %s\n", notCapableReason.c_str());
return;
Expand Down Expand Up @@ -119,7 +119,7 @@ void CActiveMasternode::ManageStatus()
}
}

// Send stop dseep to network for remote masternode
// Send stop dseep to network for remote Masternode
bool CActiveMasternode::StopMasterNode(std::string strService, std::string strKeyMasternode, std::string& errorMessage) {
CTxIn vin;
CKey keyMasternode;
Expand All @@ -133,10 +133,10 @@ bool CActiveMasternode::StopMasterNode(std::string strService, std::string strKe
return StopMasterNode(vin, CService(strService), keyMasternode, pubKeyMasternode, errorMessage);
}

// Send stop dseep to network for main masternode
// Send stop dseep to network for main Masternode
bool CActiveMasternode::StopMasterNode(std::string& errorMessage) {
if(status != MASTERNODE_IS_CAPABLE && status != MASTERNODE_REMOTELY_ENABLED) {
errorMessage = "masternode is not in a running status";
errorMessage = "Masternode is not in a running status";
LogPrintf("CActiveMasternode::StopMasterNode() - Error: %s\n", errorMessage.c_str());
return false;
}
Expand All @@ -155,15 +155,15 @@ bool CActiveMasternode::StopMasterNode(std::string& errorMessage) {
return StopMasterNode(vin, service, keyMasternode, pubKeyMasternode, errorMessage);
}

// Send stop dseep to network for any masternode
// Send stop dseep to network for any Masternode
bool CActiveMasternode::StopMasterNode(CTxIn vin, CService service, CKey keyMasternode, CPubKey pubKeyMasternode, std::string& errorMessage) {
pwalletMain->UnlockCoin(vin.prevout);
return Dseep(vin, service, keyMasternode, pubKeyMasternode, errorMessage, true);
}

bool CActiveMasternode::Dseep(std::string& errorMessage) {
if(status != MASTERNODE_IS_CAPABLE && status != MASTERNODE_REMOTELY_ENABLED) {
errorMessage = "masternode is not in a running status";
errorMessage = "Masternode is not in a running status";
LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", errorMessage.c_str());
return false;
}
Expand Down Expand Up @@ -200,16 +200,16 @@ bool CActiveMasternode::Dseep(CTxIn vin, CService service, CKey keyMasternode, C
return false;
}

// Update Last Seen timestamp in masternode list
// Update Last Seen timestamp in Masternode list
CMasternode* pmn = mnodeman.Find(vin);
if(pmn != NULL)
{
pmn->UpdateLastSeen();
}
else
{
// Seems like we are trying to send a ping while the masternode is not registered in the network
retErrorMessage = "Darksend Masternode List doesn't include our masternode, Shutting down masternode pinging service! " + vin.ToString();
// Seems like we are trying to send a ping while the Masternode is not registered in the network
retErrorMessage = "Darksend Masternode List doesn't include our Masternode, Shutting down Masternode pinging service! " + vin.ToString();
LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", retErrorMessage.c_str());
status = MASTERNODE_NOT_CAPABLE;
notCapableReason = retErrorMessage;
Expand Down Expand Up @@ -270,7 +270,7 @@ bool CActiveMasternode::Register(CTxIn vin, CService service, CKey keyCollateral
CMasternode* pmn = mnodeman.Find(vin);
if(pmn == NULL)
{
LogPrintf("CActiveMasternode::Register() - Adding to masternode list service: %s - vin: %s\n", service.ToString().c_str(), vin.ToString().c_str());
LogPrintf("CActiveMasternode::Register() - Adding to Masternode list service: %s - vin: %s\n", service.ToString().c_str(), vin.ToString().c_str());
CMasternode mn(service, vin, pubKeyCollateralAddress, vchMasterNodeSignature, masterNodeSignatureTime, pubKeyMasternode, PROTOCOL_VERSION);
mn.UpdateLastSeen(masterNodeSignatureTime);
mnodeman.Add(mn);
Expand Down Expand Up @@ -327,7 +327,7 @@ bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secr
}


// Extract masternode vin information from output
// Extract Masternode vin information from output
bool CActiveMasternode::GetVinFromOutput(COutput out, CTxIn& vin, CPubKey& pubkey, CKey& secretKey) {

CScript pubScript;
Expand All @@ -354,7 +354,7 @@ bool CActiveMasternode::GetVinFromOutput(COutput out, CTxIn& vin, CPubKey& pubke
return true;
}

// get all possible outputs for running masternode
// get all possible outputs for running Masternode
vector<COutput> CActiveMasternode::SelectCoinsMasternode()
{
vector<COutput> vCoins;
Expand All @@ -373,7 +373,7 @@ vector<COutput> CActiveMasternode::SelectCoinsMasternode()
return filteredCoins;
}

// when starting a masternode, this can enable to run as a hot wallet with no funds
// when starting a Masternode, this can enable to run as a hot wallet with no funds
bool CActiveMasternode::EnableHotColdMasterNode(CTxIn& newVin, CService& newService)
{
if(!fMasterNode) return false;
Expand Down
34 changes: 21 additions & 13 deletions src/activemasternode.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
#include "wallet.h"
#include "darksend.h"

// Responsible for activating the masternode and pinging the network
// Responsible for activating the Masternode and pinging the network
class CActiveMasternode
{
public:
// Initialized by init.cpp
// Keys for the main masternode
// Keys for the main Masternode
CPubKey pubKeyMasternode;

// Initialized while registering masternode
// Initialized while registering Masternode
CTxIn vin;
CService service;

Expand All @@ -34,25 +34,33 @@ class CActiveMasternode
status = MASTERNODE_NOT_PROCESSED;
}

void ManageStatus(); // manage status of main masternode
/// Manage status of main Masternode
void ManageStatus();

bool Dseep(std::string& errorMessage); // ping for main masternode
bool Dseep(CTxIn vin, CService service, CKey key, CPubKey pubKey, std::string &retErrorMessage, bool stop); // ping for any masternode
/// 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);

bool StopMasterNode(std::string& errorMessage); // stop main masternode
bool StopMasterNode(std::string strService, std::string strKeyMasternode, std::string& errorMessage); // stop remote masternode
bool StopMasterNode(CTxIn vin, CService service, CKey key, CPubKey pubKey, std::string& errorMessage); // stop any masternode
/// 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);

bool Register(std::string strService, std::string strKey, std::string txHash, std::string strOutputIndex, std::string& errorMessage); // register remote masternode
bool Register(CTxIn vin, CService service, CKey key, CPubKey pubKey, CKey keyMasternode, CPubKey pubKeyMasternode, std::string &retErrorMessage); // register any masternode
/// Register remote Masternode
bool Register(std::string strService, std::string strKey, std::string txHash, std::string strOutputIndex, std::string& errorMessage);
/// Register any Masternode
bool Register(CTxIn vin, CService service, CKey key, CPubKey pubKey, CKey keyMasternode, CPubKey pubKeyMasternode, std::string &retErrorMessage);

// get 1000DRK input that can be used for the masternode
/// Get 1000DRK input that can be used for the Masternode
bool GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey);
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);

// enable hot wallet mode (run a masternode with no funds)
/// Enable hot wallet mode (run a Masternode with no funds)
bool EnableHotColdMasterNode(CTxIn& vin, CService& addr);
};

Expand Down
Loading