mirror of
https://github.com/jwinterm/aeon.git
synced 2026-10-18 05:11:27 +02:00
fixes
This commit is contained in:
@@ -64,19 +64,6 @@ namespace
|
||||
return err;
|
||||
}
|
||||
|
||||
bool parse_payment_id(const std::string& payment_id_str, crypto::hash& payment_id)
|
||||
{
|
||||
blobdata payment_id_data;
|
||||
if(!string_tools::parse_hexstr_to_binbuff(payment_id_str, payment_id_data))
|
||||
return false;
|
||||
|
||||
if(sizeof(crypto::hash) != payment_id_data.size())
|
||||
return false;
|
||||
|
||||
payment_id = *reinterpret_cast<const crypto::hash*>(payment_id_data.data());
|
||||
return true;
|
||||
}
|
||||
|
||||
class message_writer
|
||||
{
|
||||
public:
|
||||
@@ -181,6 +168,7 @@ simple_wallet::simple_wallet()
|
||||
{
|
||||
m_cmd_binder.set_handler("start_mining", boost::bind(&simple_wallet::start_mining, this, _1), "start_mining [<number_of_threads>] - Start mining in daemon");
|
||||
m_cmd_binder.set_handler("stop_mining", boost::bind(&simple_wallet::stop_mining, this, _1), "Stop mining in daemon");
|
||||
m_cmd_binder.set_handler("save_bc", boost::bind(&simple_wallet::save_bc, this, _1), "Save current blockchain data");
|
||||
m_cmd_binder.set_handler("refresh", boost::bind(&simple_wallet::refresh, this, _1), "Resynchronize transactions and balance");
|
||||
m_cmd_binder.set_handler("balance", boost::bind(&simple_wallet::show_balance, this, _1), "Show current wallet balance");
|
||||
m_cmd_binder.set_handler("incoming_transfers", boost::bind(&simple_wallet::show_incoming_transfers, this, _1), "incoming_transfers [available|unavailable] - Show incoming transfers - all of them or filter them by availability");
|
||||
@@ -491,6 +479,22 @@ bool simple_wallet::stop_mining(const std::vector<std::string>& args)
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::save_bc(const std::vector<std::string>& args)
|
||||
{
|
||||
if (!try_connect_to_daemon())
|
||||
return true;
|
||||
|
||||
COMMAND_RPC_SAVE_BC::request req;
|
||||
COMMAND_RPC_SAVE_BC::response res;
|
||||
bool r = net_utils::invoke_http_json_remote_command2(m_daemon_address + "/save_bc", req, res, m_http_client);
|
||||
std::string err = interpret_rpc_response(r, res.status);
|
||||
if (err.empty())
|
||||
success_msg_writer() << "Blockchain saved";
|
||||
else
|
||||
fail_msg_writer() << "Blockchain can't be saved: " << err;
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void simple_wallet::on_new_block(uint64_t height, const cryptonote::block& block)
|
||||
{
|
||||
m_refresh_progress_reporter.update(height, false);
|
||||
@@ -663,7 +667,7 @@ bool simple_wallet::show_payments(const std::vector<std::string> &args)
|
||||
for(std::string arg : args)
|
||||
{
|
||||
crypto::hash payment_id;
|
||||
if(parse_payment_id(arg, payment_id))
|
||||
if(tools::wallet2::parse_payment_id(arg, payment_id))
|
||||
{
|
||||
std::list<tools::wallet2::payment_details> payments;
|
||||
m_wallet->get_payments(payment_id, payments);
|
||||
@@ -746,7 +750,7 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
|
||||
local_args.pop_back();
|
||||
|
||||
crypto::hash payment_id;
|
||||
bool r = parse_payment_id(payment_id_str, payment_id);
|
||||
bool r = tools::wallet2::parse_payment_id(payment_id_str, payment_id);
|
||||
if(r)
|
||||
{
|
||||
std::string extra_nonce;
|
||||
@@ -927,7 +931,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
if (command_line::get_arg(vm, command_line::arg_help))
|
||||
{
|
||||
success_msg_writer() << "bytecoin wallet v" << PROJECT_VERSION_LONG;
|
||||
success_msg_writer() << CRYPTONOTE_NAME << " wallet v" << PROJECT_VERSION_LONG;
|
||||
success_msg_writer() << "Usage: simplewallet [--wallet-file=<file>|--generate-new-wallet=<file>] [--daemon-address=<host>:<port>] [<COMMAND>]";
|
||||
success_msg_writer() << desc_all << '\n' << w.get_commands_str();
|
||||
return false;
|
||||
@@ -944,7 +948,7 @@ int main(int argc, char* argv[])
|
||||
return true;
|
||||
});
|
||||
if (!r)
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
//set up logging options
|
||||
log_space::get_set_log_detalisation_level(true, LOG_LEVEL_2);
|
||||
@@ -1037,15 +1041,21 @@ int main(int argc, char* argv[])
|
||||
|
||||
std::vector<std::string> command = command_line::get_arg(vm, arg_command);
|
||||
if (!command.empty())
|
||||
{
|
||||
w.process_command(command);
|
||||
|
||||
tools::signal_handler::install([&w] {
|
||||
w.stop();
|
||||
});
|
||||
w.run();
|
||||
w.deinit();
|
||||
}
|
||||
else
|
||||
{
|
||||
tools::signal_handler::install([&w] {
|
||||
w.stop();
|
||||
});
|
||||
w.run();
|
||||
|
||||
w.deinit();
|
||||
w.deinit();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return 0;
|
||||
//CATCH_ENTRY_L0("main", 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user