tabs to spaces
This commit is contained in:
parent
90f508c67e
commit
aa96d701af
@ -210,114 +210,114 @@ Value masternode(const Array& params, bool fHelp)
|
||||
|
||||
if (strCommand == "start-alias")
|
||||
{
|
||||
if (params.size() < 2){
|
||||
throw runtime_error(
|
||||
"command needs at least 2 parameters\n");
|
||||
}
|
||||
|
||||
std::string alias = params[1].get_str().c_str();
|
||||
|
||||
if(pwalletMain->IsLocked()) {
|
||||
SecureString strWalletPass;
|
||||
strWalletPass.reserve(100);
|
||||
|
||||
if (params.size() == 3){
|
||||
strWalletPass = params[2].get_str().c_str();
|
||||
} else {
|
||||
throw runtime_error(
|
||||
"Your wallet is locked, passphrase is required\n");
|
||||
}
|
||||
|
||||
if(!pwalletMain->Unlock(strWalletPass)){
|
||||
return "incorrect passphrase";
|
||||
}
|
||||
if (params.size() < 2){
|
||||
throw runtime_error(
|
||||
"command needs at least 2 parameters\n");
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
std::string alias = params[1].get_str().c_str();
|
||||
|
||||
Object statusObj;
|
||||
statusObj.push_back(Pair("alias", alias));
|
||||
if(pwalletMain->IsLocked()) {
|
||||
SecureString strWalletPass;
|
||||
strWalletPass.reserve(100);
|
||||
|
||||
BOOST_FOREACH(CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
|
||||
if(mne.getAlias() == alias) {
|
||||
found = true;
|
||||
std::string errorMessage;
|
||||
if (params.size() == 3){
|
||||
strWalletPass = params[2].get_str().c_str();
|
||||
} else {
|
||||
throw runtime_error(
|
||||
"Your wallet is locked, passphrase is required\n");
|
||||
}
|
||||
|
||||
bool result = activeMasternode.Register(mne.getIp(), mne.getPrivKey(), mne.getTxHash(), mne.getOutputIndex(), errorMessage);
|
||||
if(!pwalletMain->Unlock(strWalletPass)){
|
||||
return "incorrect passphrase";
|
||||
}
|
||||
}
|
||||
|
||||
statusObj.push_back(Pair("result", result ? "successful" : "failed"));
|
||||
if(!result) {
|
||||
statusObj.push_back(Pair("errorMessage", errorMessage));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool found = false;
|
||||
|
||||
if(!found) {
|
||||
statusObj.push_back(Pair("result", "failed"));
|
||||
statusObj.push_back(Pair("errorMessage", "could not find alias in config. Verify with list-conf."));
|
||||
}
|
||||
Object statusObj;
|
||||
statusObj.push_back(Pair("alias", alias));
|
||||
|
||||
pwalletMain->Lock();
|
||||
return statusObj;
|
||||
BOOST_FOREACH(CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
|
||||
if(mne.getAlias() == alias) {
|
||||
found = true;
|
||||
std::string errorMessage;
|
||||
|
||||
bool result = activeMasternode.Register(mne.getIp(), mne.getPrivKey(), mne.getTxHash(), mne.getOutputIndex(), errorMessage);
|
||||
|
||||
statusObj.push_back(Pair("result", result ? "successful" : "failed"));
|
||||
if(!result) {
|
||||
statusObj.push_back(Pair("errorMessage", errorMessage));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
statusObj.push_back(Pair("result", "failed"));
|
||||
statusObj.push_back(Pair("errorMessage", "could not find alias in config. Verify with list-conf."));
|
||||
}
|
||||
|
||||
pwalletMain->Lock();
|
||||
return statusObj;
|
||||
|
||||
}
|
||||
|
||||
if (strCommand == "start-many")
|
||||
{
|
||||
if(pwalletMain->IsLocked()) {
|
||||
SecureString strWalletPass;
|
||||
strWalletPass.reserve(100);
|
||||
if(pwalletMain->IsLocked()) {
|
||||
SecureString strWalletPass;
|
||||
strWalletPass.reserve(100);
|
||||
|
||||
if (params.size() == 2){
|
||||
strWalletPass = params[1].get_str().c_str();
|
||||
} else {
|
||||
throw runtime_error(
|
||||
"Your wallet is locked, passphrase is required\n");
|
||||
}
|
||||
if (params.size() == 2){
|
||||
strWalletPass = params[1].get_str().c_str();
|
||||
} else {
|
||||
throw runtime_error(
|
||||
"Your wallet is locked, passphrase is required\n");
|
||||
}
|
||||
|
||||
if(!pwalletMain->Unlock(strWalletPass)){
|
||||
return "incorrect passphrase";
|
||||
}
|
||||
}
|
||||
if(!pwalletMain->Unlock(strWalletPass)){
|
||||
return "incorrect passphrase";
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
|
||||
mnEntries = masternodeConfig.getEntries();
|
||||
std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
|
||||
mnEntries = masternodeConfig.getEntries();
|
||||
|
||||
int total = 0;
|
||||
int successful = 0;
|
||||
int fail = 0;
|
||||
int total = 0;
|
||||
int successful = 0;
|
||||
int fail = 0;
|
||||
|
||||
Object resultsObj;
|
||||
Object resultsObj;
|
||||
|
||||
BOOST_FOREACH(CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
|
||||
total++;
|
||||
BOOST_FOREACH(CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
|
||||
total++;
|
||||
|
||||
std::string errorMessage;
|
||||
std::string errorMessage;
|
||||
|
||||
bool result = activeMasternode.Register(mne.getIp(), mne.getPrivKey(), mne.getTxHash(), mne.getOutputIndex(), errorMessage);
|
||||
bool result = activeMasternode.Register(mne.getIp(), mne.getPrivKey(), mne.getTxHash(), mne.getOutputIndex(), errorMessage);
|
||||
|
||||
Object statusObj;
|
||||
statusObj.push_back(Pair("alias", mne.getAlias()));
|
||||
Object statusObj;
|
||||
statusObj.push_back(Pair("alias", mne.getAlias()));
|
||||
statusObj.push_back(Pair("result", result ? "successful" : "failed"));
|
||||
|
||||
if(result) {
|
||||
successful++;
|
||||
} else {
|
||||
fail++;
|
||||
statusObj.push_back(Pair("errorMessage", errorMessage));
|
||||
}
|
||||
if(result) {
|
||||
successful++;
|
||||
} else {
|
||||
fail++;
|
||||
statusObj.push_back(Pair("errorMessage", errorMessage));
|
||||
}
|
||||
|
||||
resultsObj.push_back(Pair("status", statusObj));
|
||||
}
|
||||
pwalletMain->Lock();
|
||||
resultsObj.push_back(Pair("status", statusObj));
|
||||
}
|
||||
pwalletMain->Lock();
|
||||
|
||||
Object returnObj;
|
||||
returnObj.push_back(Pair("overall", "Successfully started " + boost::lexical_cast<std::string>(successful) + " masternodes, failed to start " +
|
||||
boost::lexical_cast<std::string>(fail) + ", total " + boost::lexical_cast<std::string>(total)));
|
||||
returnObj.push_back(Pair("detail", resultsObj));
|
||||
Object returnObj;
|
||||
returnObj.push_back(Pair("overall", "Successfully started " + boost::lexical_cast<std::string>(successful) + " masternodes, failed to start " +
|
||||
boost::lexical_cast<std::string>(fail) + ", total " + boost::lexical_cast<std::string>(total)));
|
||||
returnObj.push_back(Pair("detail", resultsObj));
|
||||
|
||||
return returnObj;
|
||||
return returnObj;
|
||||
}
|
||||
|
||||
if (strCommand == "debug")
|
||||
@ -412,8 +412,8 @@ Value masternode(const Array& params, bool fHelp)
|
||||
|
||||
if(strCommand == "list-conf")
|
||||
{
|
||||
std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
|
||||
mnEntries = masternodeConfig.getEntries();
|
||||
std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
|
||||
mnEntries = masternodeConfig.getEntries();
|
||||
|
||||
Object resultObj;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user