mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 13:32:47 +01:00
55cae78c3b
- refactored CActiveMasternode - added masternodeconfig to handle remote masternode configuration - read masternodeconfig upon init - new masternode rpc commands: stop-many, start-alias, stop-alias, list-conf - added notCapableReason field for better handling not capable issues
33 lines
1001 B
C++
33 lines
1001 B
C++
#include "masternodeconfig.h"
|
|
#include "util.h"
|
|
|
|
CMasternodeConfig masternodeConfig;
|
|
|
|
void CMasternodeConfig::add(std::string alias, std::string ip, std::string privKey, std::string txHash, std::string outputIndex) {
|
|
CMasternodeEntry cme(alias, ip, privKey, txHash, outputIndex);
|
|
entries.push_back(cme);
|
|
}
|
|
|
|
void CMasternodeConfig::read(boost::filesystem::path path) {
|
|
boost::filesystem::ifstream streamConfig(GetMasternodeConfigFile());
|
|
if (!streamConfig.good()) {
|
|
return; // No masternode.conf file is OK
|
|
}
|
|
|
|
for(std::string line; std::getline(streamConfig, line); )
|
|
{
|
|
if(line.empty()) {
|
|
continue;
|
|
}
|
|
std::istringstream iss(line);
|
|
std::string alias, ip, privKey, txHash, outputIndex;
|
|
if (!(iss >> alias >> ip >> privKey >> txHash >> outputIndex)) {
|
|
LogPrintf("CMasternodeConfig::read - Could not parse masternode.conf. Line: %s\n", line.c_str());
|
|
continue;
|
|
}
|
|
add(alias, ip, privKey, txHash, outputIndex);
|
|
}
|
|
|
|
streamConfig.close();
|
|
}
|