aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/command_parser_executor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/command_parser_executor.cpp')
-rw-r--r--src/daemon/command_parser_executor.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index af46453cd..ddb5e95df 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -252,20 +252,18 @@ bool t_command_parser_executor::start_mining(const std::vector<std::string>& arg
return true;
}
- cryptonote::account_public_address adr;
- bool has_payment_id;
- crypto::hash8 payment_id;
+ cryptonote::address_parse_info info;
bool testnet = false;
- if(!cryptonote::get_account_integrated_address_from_str(adr, has_payment_id, payment_id, false, args.front()))
+ if(!cryptonote::get_account_address_from_str(info, false, args.front()))
{
- if(!cryptonote::get_account_integrated_address_from_str(adr, has_payment_id, payment_id, true, args.front()))
+ if(!cryptonote::get_account_address_from_str(info, true, 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_integrated_address_from_str(adr, has_payment_id, payment_id, false, address_str))
+ if(!cryptonote::get_account_address_from_str(info, false, address_str))
{
- if(!cryptonote::get_account_integrated_address_from_str(adr, has_payment_id, payment_id, true, address_str))
+ if(!cryptonote::get_account_address_from_str(info, true, address_str))
{
std::cout << "target account address has wrong format" << std::endl;
return true;
@@ -281,6 +279,11 @@ bool t_command_parser_executor::start_mining(const std::vector<std::string>& arg
testnet = true;
}
}
+ if (info.is_subaddress)
+ {
+ 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;
uint64_t threads_count = 1;
@@ -307,7 +310,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(adr, threads_count, testnet, do_background_mining, ignore_battery);
+ m_executor.start_mining(info.address, threads_count, testnet, do_background_mining, ignore_battery);
return true;
}
@@ -343,7 +346,7 @@ bool t_command_parser_executor::set_limit(const std::vector<std::string>& args)
try {
limit = std::stoll(args[0]);
}
- catch(const std::invalid_argument& ex) {
+ catch(const std::exception& ex) {
std::cout << "failed to parse argument" << std::endl;
return false;
}
@@ -363,7 +366,7 @@ bool t_command_parser_executor::set_limit_up(const std::vector<std::string>& arg
try {
limit = std::stoll(args[0]);
}
- catch(const std::invalid_argument& ex) {
+ catch(const std::exception& ex) {
std::cout << "failed to parse argument" << std::endl;
return false;
}
@@ -383,7 +386,7 @@ bool t_command_parser_executor::set_limit_down(const std::vector<std::string>& a
try {
limit = std::stoll(args[0]);
}
- catch(const std::invalid_argument& ex) {
+ catch(const std::exception& ex) {
std::cout << "failed to parse argument" << std::endl;
return false;
}
@@ -402,7 +405,7 @@ bool t_command_parser_executor::out_peers(const std::vector<std::string>& args)
limit = std::stoi(args[0]);
}
- catch(std::invalid_argument& ex) {
+ catch(std::exception& ex) {
_erro("stoi exception");
return false;
}
@@ -432,7 +435,7 @@ bool t_command_parser_executor::hard_fork_info(const std::vector<std::string>& a
try {
version = std::stoi(args[0]);
}
- catch(std::invalid_argument& ex) {
+ catch(std::exception& ex) {
return false;
}
if (version <= 0 || version > 255)
@@ -457,7 +460,14 @@ bool t_command_parser_executor::ban(const std::vector<std::string>& args)
time_t seconds = P2P_IP_BLOCKTIME;
if (args.size() > 1)
{
- seconds = std::stoi(args[1]);
+ try
+ {
+ seconds = std::stoi(args[1]);
+ }
+ catch (const std::exception &e)
+ {
+ return false;
+ }
if (seconds == 0)
{
return false;