aboutsummaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/command_parser_executor.cpp38
-rw-r--r--src/daemon/main.cpp2
-rw-r--r--src/daemon/rpc_command_executor.cpp2
3 files changed, 26 insertions, 16 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;
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index 21d20eeaf..5d548f410 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -61,7 +61,7 @@ int main(int argc, char const * argv[])
// TODO parse the debug options like set log level right here at start
- tools::sanitize_locale();
+ tools::on_startup();
epee::string_tools::set_module_name_and_folder(argv[0]);
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index ef593237c..be1ed20ba 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -1014,7 +1014,7 @@ bool t_rpc_command_executor::print_transaction_pool_stats() {
bool t_rpc_command_executor::start_mining(cryptonote::account_public_address address, uint64_t num_threads, bool testnet, bool do_background_mining, bool ignore_battery) {
cryptonote::COMMAND_RPC_START_MINING::request req;
cryptonote::COMMAND_RPC_START_MINING::response res;
- req.miner_address = cryptonote::get_account_address_as_str(testnet, address);
+ req.miner_address = cryptonote::get_account_address_as_str(testnet, false, address);
req.threads_count = num_threads;
req.do_background_mining = do_background_mining;
req.ignore_battery = ignore_battery;