Add donation mining

This commit is contained in:
Javier Smooth
2015-08-11 22:44:35 -07:00
parent 80ec551070
commit e35f3c2bab
2 changed files with 13 additions and 2 deletions
+1
View File
@@ -122,3 +122,4 @@
#define THREAD_STACK_SIZE 5 * 1024 * 1024
#define CONFIG_DONATION_ADDRESS "WmsSWgtT1JPg5e3cK41hKXSHVpKW7e47bjgiKmWZkYrhSS5LhRemNyqayaSBtAQ6517eo5PtH9wxHVmM78JDZSUu2W8PqRiNs"
+12 -2
View File
@@ -58,6 +58,7 @@ namespace cryptonote
const command_line::arg_descriptor<std::string> arg_extra_messages = {"extra-messages-file", "Specify file for extra messages to include into coinbase transactions", "", true};
const command_line::arg_descriptor<std::string> arg_start_mining = {"start-mining", "Specify wallet address to mining for", "", true};
const command_line::arg_descriptor<uint32_t> arg_mining_threads = {"mining-threads", "Specify mining threads count", 0, true};
const command_line::arg_descriptor<bool> arg_donate = {"donate", "Enable background donation mining"};
}
@@ -169,6 +170,7 @@ namespace cryptonote
command_line::add_arg(desc, arg_extra_messages);
command_line::add_arg(desc, arg_start_mining);
command_line::add_arg(desc, arg_mining_threads);
command_line::add_arg(desc, arg_donate);
}
//-----------------------------------------------------------------------------------------------------
bool miner::init(const boost::program_options::variables_map& vm)
@@ -196,9 +198,17 @@ namespace cryptonote
LOG_PRINT_L0("Loaded " << m_extra_messages.size() << " extra messages, current index " << m_config.current_extra_message_index);
}
if(command_line::has_arg(vm, arg_start_mining))
if(command_line::has_arg(vm, arg_start_mining) || command_line::has_arg(vm, arg_donate))
{
if(!cryptonote::get_account_address_from_str(m_mine_address, command_line::get_arg(vm, arg_start_mining)))
if(command_line::has_arg(vm, arg_donate))
{
if (!cryptonote::get_account_address_from_str(m_mine_address, std::string(CONFIG_DONATION_ADDRESS)))
{
LOG_ERROR("Internal error: malformed donation address");
return false;
}
}
else if(!cryptonote::get_account_address_from_str(m_mine_address, command_line::get_arg(vm, arg_start_mining)))
{
LOG_ERROR("Target account address " << command_line::get_arg(vm, arg_start_mining) << " has wrong format, starting daemon canceled");
return false;