aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/command_parser_executor.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-03-05 19:11:20 +0200
committerRiccardo Spagni <ric@spagni.net>2018-03-05 19:11:20 +0200
commit4f93f745284c10f12e2524f5211030085d9626cf (patch)
tree29b5f359a8f346305bcf7bf82f459f421bfaa7a7 /src/daemon/command_parser_executor.cpp
parent033ead4bad368aae54d26e8d1d66b33a44e5345a (diff)
parent0e7ad2e2c95814ed13b6d84fc3647fa5652cc134 (diff)
downloadmonzero-core-4f93f745284c10f12e2524f5211030085d9626cf.tar.gz
monzero-core-4f93f745284c10f12e2524f5211030085d9626cf.tar.xz
monzero-core-4f93f745284c10f12e2524f5211030085d9626cf.zip
Merge pull request #3277
0e7ad2e2 Wallet API: generalize 'bool testnet' to 'NetworkType nettype' (stoffu) af773211 Stagenet (stoffu) cc9a0bee command_line: allow args to depend on more than one args (stoffu) 55f8d917 command_line::get_arg: remove 'required' for dependent args as they're always optional (stoffu) 450306a0 command line: allow has_arg to handle arg_descriptor<bool,false,true> #3318 (stoffu) 9f9e095a Use `genesis_tx` parameter in `generate_genesis_block`. #3261 (Jean Pierre Dudey)
Diffstat (limited to 'src/daemon/command_parser_executor.cpp')
-rw-r--r--src/daemon/command_parser_executor.cpp50
1 files changed, 32 insertions, 18 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index 09e425dd1..7a89ebc0c 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -268,30 +268,44 @@ bool t_command_parser_executor::start_mining(const std::vector<std::string>& arg
}
cryptonote::address_parse_info info;
- bool testnet = false;
- if(!cryptonote::get_account_address_from_str(info, false, args.front()))
+ cryptonote::network_type nettype = cryptonote::MAINNET;
+ if(!cryptonote::get_account_address_from_str(info, cryptonote::MAINNET, args.front()))
{
- if(!cryptonote::get_account_address_from_str(info, true, args.front()))
+ if(!cryptonote::get_account_address_from_str(info, cryptonote::TESTNET, args.front()))
{
- bool dnssec_valid;
- std::string address_str = tools::dns_utils::get_account_address_as_str_from_url(args.front(), dnssec_valid,
- [](const std::string &url, const std::vector<std::string> &addresses, bool dnssec_valid){return addresses[0];});
- if(!cryptonote::get_account_address_from_str(info, false, address_str))
+ if(!cryptonote::get_account_address_from_str(info, cryptonote::STAGENET, args.front()))
{
- if(!cryptonote::get_account_address_from_str(info, true, address_str))
+ bool dnssec_valid;
+ std::string address_str = tools::dns_utils::get_account_address_as_str_from_url(args.front(), dnssec_valid,
+ [](const std::string &url, const std::vector<std::string> &addresses, bool dnssec_valid){return addresses[0];});
+ if(!cryptonote::get_account_address_from_str(info, cryptonote::MAINNET, address_str))
{
- std::cout << "target account address has wrong format" << std::endl;
- return true;
- }
- else
- {
- testnet = true;
+ if(!cryptonote::get_account_address_from_str(info, cryptonote::TESTNET, address_str))
+ {
+ if(!cryptonote::get_account_address_from_str(info, cryptonote::STAGENET, address_str))
+ {
+ std::cout << "target account address has wrong format" << std::endl;
+ return true;
+ }
+ else
+ {
+ nettype = cryptonote::STAGENET;
+ }
+ }
+ else
+ {
+ nettype = cryptonote::TESTNET;
+ }
}
}
+ else
+ {
+ nettype = cryptonote::STAGENET;
+ }
}
else
{
- testnet = true;
+ nettype = cryptonote::TESTNET;
}
}
if (info.is_subaddress)
@@ -299,8 +313,8 @@ bool t_command_parser_executor::start_mining(const std::vector<std::string>& arg
tools::fail_msg_writer() << "subaddress for mining reward is not yet supported!" << std::endl;
return true;
}
- if(testnet)
- std::cout << "Mining to a testnet address, make sure this is intentional!" << std::endl;
+ if(nettype != cryptonote::MAINNET)
+ std::cout << "Mining to a " << (nettype == cryptonote::TESTNET ? "testnet" : "stagenet") << "address, make sure this is intentional!" << std::endl;
uint64_t threads_count = 1;
bool do_background_mining = false;
bool ignore_battery = false;
@@ -325,7 +339,7 @@ bool t_command_parser_executor::start_mining(const std::vector<std::string>& arg
threads_count = (ok && 0 < threads_count) ? threads_count : 1;
}
- m_executor.start_mining(info.address, threads_count, testnet, do_background_mining, ignore_battery);
+ m_executor.start_mining(info.address, threads_count, nettype, do_background_mining, ignore_battery);
return true;
}