Extract scoped_message_writer from simplewallet

This commit is contained in:
Zachary Michaels 2014-06-23 21:54:23 -04:00
parent ec0a8d1339
commit e0e6037388
3 changed files with 166 additions and 149 deletions

View File

@ -24,7 +24,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#include "misc_log_ex.h"
#pragma once
@ -257,4 +257,4 @@ namespace misc_utils
}
}
}
}
}

View File

@ -0,0 +1,95 @@
#pragma once
#include "misc_log_ex.h"
#include <iostream>
namespace tools
{
class scoped_message_writer
{
private:
bool m_flush;
std::stringstream m_oss;
epee::log_space::console_colors m_color;
bool m_bright;
int m_log_level;
public:
scoped_message_writer(
epee::log_space::console_colors color = epee::log_space::console_color_default
, bool bright = false
, std::string&& prefix = std::string()
, int log_level = LOG_LEVEL_2
)
: m_flush(true)
, m_color(color)
, m_bright(bright)
, m_log_level(log_level)
{
m_oss << prefix;
}
scoped_message_writer(scoped_message_writer&& rhs)
: m_flush(std::move(rhs.m_flush))
#if defined(_MSC_VER)
, m_oss(std::move(rhs.m_oss))
#else
// GCC bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54316
, m_oss(rhs.m_oss.str(), std::ios_base::out | std::ios_base::ate)
#endif
, m_color(std::move(rhs.m_color))
, m_log_level(std::move(rhs.m_log_level))
{
rhs.m_flush = false;
}
scoped_message_writer(scoped_message_writer& rhs) = delete;
scoped_message_writer& operator=(scoped_message_writer& rhs) = delete;
scoped_message_writer& operator=(scoped_message_writer&& rhs) = delete;
template<typename T>
std::ostream& operator<<(const T& val)
{
m_oss << val;
return m_oss;
}
~scoped_message_writer()
{
if (m_flush)
{
m_flush = false;
LOG_PRINT(m_oss.str(), m_log_level)
if (epee::log_space::console_color_default == m_color)
{
std::cout << m_oss.str();
}
else
{
epee::log_space::set_console_color(m_color, m_bright);
std::cout << m_oss.str();
epee::log_space::reset_console_color();
}
std::cout << std::endl;
}
}
};
scoped_message_writer success_msg_writer()
{
return scoped_message_writer(epee::log_space::console_color_green, false, std::string(), LOG_LEVEL_2);
}
scoped_message_writer msg_writer(epee::log_space::console_colors color = epee::log_space::console_color_default)
{
return scoped_message_writer(color, false, std::string(), LOG_LEVEL_2);
}
scoped_message_writer fail_msg_writer()
{
return scoped_message_writer(epee::log_space::console_color_red, true, "Error: ", LOG_LEVEL_0);
}
} // namespace tools

View File

@ -10,6 +10,7 @@
#include "include_base_utils.h"
#include "common/command_line.h"
#include "common/util.h"
#include "common/scoped_message_writer.h"
#include "p2p/net_node.h"
#include "cryptonote_protocol/cryptonote_protocol_handler.h"
#include "simplewallet.h"
@ -69,85 +70,6 @@ namespace
}
return err;
}
class message_writer
{
public:
message_writer(epee::log_space::console_colors color = epee::log_space::console_color_default, bool bright = false,
std::string&& prefix = std::string(), int log_level = LOG_LEVEL_2)
: m_flush(true)
, m_color(color)
, m_bright(bright)
, m_log_level(log_level)
{
m_oss << prefix;
}
message_writer(message_writer&& rhs)
: m_flush(std::move(rhs.m_flush))
#if defined(_MSC_VER)
, m_oss(std::move(rhs.m_oss))
#else
// GCC bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54316
, m_oss(rhs.m_oss.str(), ios_base::out | ios_base::ate)
#endif
, m_color(std::move(rhs.m_color))
, m_log_level(std::move(rhs.m_log_level))
{
rhs.m_flush = false;
}
template<typename T>
std::ostream& operator<<(const T& val)
{
m_oss << val;
return m_oss;
}
~message_writer()
{
if (m_flush)
{
m_flush = false;
LOG_PRINT(m_oss.str(), m_log_level)
if (epee::log_space::console_color_default == m_color)
{
std::cout << m_oss.str();
}
else
{
epee::log_space::set_console_color(m_color, m_bright);
std::cout << m_oss.str();
epee::log_space::reset_console_color();
}
std::cout << std::endl;
}
}
private:
message_writer(message_writer& rhs);
message_writer& operator=(message_writer& rhs);
message_writer& operator=(message_writer&& rhs);
private:
bool m_flush;
std::stringstream m_oss;
epee::log_space::console_colors m_color;
bool m_bright;
int m_log_level;
};
message_writer success_msg_writer(bool color = false)
{
return message_writer(color ? epee::log_space::console_color_green : epee::log_space::console_color_default, false, std::string(), LOG_LEVEL_2);
}
message_writer fail_msg_writer()
{
return message_writer(epee::log_space::console_color_red, true, "Error: ", LOG_LEVEL_0);
}
}
@ -164,7 +86,7 @@ std::string simple_wallet::get_commands_str()
bool simple_wallet::help(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
{
success_msg_writer() << get_commands_str();
tools::success_msg_writer() << get_commands_str();
return true;
}
@ -191,18 +113,18 @@ bool simple_wallet::set_log(const std::vector<std::string> &args)
{
if(args.size() != 1)
{
fail_msg_writer() << "use: set_log <log_level_number_0-4>";
tools::fail_msg_writer() << "use: set_log <log_level_number_0-4>";
return true;
}
uint16_t l = 0;
if(!epee::string_tools::get_xtype_from_string(l, args[0]))
{
fail_msg_writer() << "wrong number format, use: set_log <log_level_number_0-4>";
tools::fail_msg_writer() << "wrong number format, use: set_log <log_level_number_0-4>";
return true;
}
if(LOG_LEVEL_4 < l)
{
fail_msg_writer() << "wrong number range, use: set_log <log_level_number_0-4>";
tools::fail_msg_writer() << "wrong number range, use: set_log <log_level_number_0-4>";
return true;
}
@ -228,7 +150,7 @@ bool simple_wallet::ask_wallet_create_if_needed()
{
if (!m_generate_new.empty() || m_restore_deterministic_wallet)
{
fail_msg_writer() << "Attempting to generate or restore wallet, but specified file(s) exist. Exiting to not risk overwriting.";
tools::fail_msg_writer() << "Attempting to generate or restore wallet, but specified file(s) exist. Exiting to not risk overwriting.";
return false;
}
}
@ -247,7 +169,7 @@ bool simple_wallet::ask_wallet_create_if_needed()
r = true;
}else
{
fail_msg_writer() << "failed to open wallet \"" << wallet_path << "\". Keys file wasn't found";
tools::fail_msg_writer() << "failed to open wallet \"" << wallet_path << "\". Keys file wasn't found";
r = false;
}
}
@ -261,13 +183,13 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
if (!m_daemon_address.empty() && !m_daemon_host.empty() && 0 != m_daemon_port)
{
fail_msg_writer() << "you can't specify daemon host or port several times";
tools::fail_msg_writer() << "you can't specify daemon host or port several times";
return false;
}
if(!m_generate_new.empty() && !m_wallet_file.empty())
{
fail_msg_writer() << "Specifying both --generate-new-wallet=\"wallet_name\" and --wallet-file=\"wallet_name\" doesn't make sense!";
tools::fail_msg_writer() << "Specifying both --generate-new-wallet=\"wallet_name\" and --wallet-file=\"wallet_name\" doesn't make sense!";
return false;
}
else if (m_generate_new.empty() && m_wallet_file.empty())
@ -292,7 +214,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
bool r = pwd_container.read_password();
if (!r)
{
fail_msg_writer() << "failed to read wallet password";
tools::fail_msg_writer() << "failed to read wallet password";
return false;
}
}
@ -306,7 +228,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
{
if (m_non_deterministic)
{
fail_msg_writer() << "Cannot specify both --restore-deterministic-wallet and --non-deterministic";
tools::fail_msg_writer() << "Cannot specify both --restore-deterministic-wallet and --non-deterministic";
return false;
}
@ -315,14 +237,14 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
m_electrum_seed = command_line::input_line("Specify electrum seed: ");
if (m_electrum_seed.empty())
{
fail_msg_writer() << "specify a recovery parameter with the --electrum-seed=\"words list here\"";
tools::fail_msg_writer() << "specify a recovery parameter with the --electrum-seed=\"words list here\"";
return false;
}
}
if (!crypto::ElectrumWords::words_to_bytes(m_electrum_seed, m_recovery_key))
{
fail_msg_writer() << "electrum-style word list failed verification";
tools::fail_msg_writer() << "electrum-style word list failed verification";
return false;
}
}
@ -362,7 +284,7 @@ bool simple_wallet::try_connect_to_daemon()
{
if (!m_wallet->check_connection())
{
fail_msg_writer() << "wallet failed to connect to daemon (" << m_daemon_address << "). " <<
tools::fail_msg_writer() << "wallet failed to connect to daemon (" << m_daemon_address << "). " <<
"Daemon either is not started or passed wrong port. " <<
"Please, make sure that daemon is running or restart the wallet with correct daemon address.";
return false;
@ -386,7 +308,7 @@ bool simple_wallet::new_wallet(const string &wallet_file, const std::string& pas
}
catch (const std::exception& e)
{
fail_msg_writer() << "failed to generate new wallet: " << e.what();
tools::fail_msg_writer() << "failed to generate new wallet: " << e.what();
return false;
}
@ -399,7 +321,7 @@ bool simple_wallet::new_wallet(const string &wallet_file, const std::string& pas
std::string print_electrum = "";
success_msg_writer() <<
tools::success_msg_writer() <<
"**********************************************************************\n" <<
"Your wallet has been generated.\n" <<
"To start synchronizing with the daemon use \"refresh\" command.\n" <<
@ -411,10 +333,10 @@ bool simple_wallet::new_wallet(const string &wallet_file, const std::string& pas
if (!two_random)
{
success_msg_writer(true) << "\nPLEASE NOTE: the following 24 words can be used to recover access to your wallet. Please write them down and store them somewhere safe and secure. Please do not store them in your email or on file storage services outside of your immediate control. You will not be able to view these words again, so it is imperative to make note of them now.\n";
tools::msg_writer() << "\nPLEASE NOTE: the following 24 words can be used to recover access to your wallet. Please write them down and store them somewhere safe and secure. Please do not store them in your email or on file storage services outside of your immediate control. You will not be able to view these words again, so it is imperative to make note of them now.\n";
std::cout << electrum_words << std::endl;
}
success_msg_writer() << "**********************************************************************";
tools::success_msg_writer() << "**********************************************************************";
return true;
}
@ -432,14 +354,14 @@ bool simple_wallet::open_wallet(const string &wallet_file, const std::string& pa
}
catch (const std::exception& e)
{
fail_msg_writer() << "failed to load wallet: " << e.what();
tools::fail_msg_writer() << "failed to load wallet: " << e.what();
return false;
}
m_wallet->init(m_daemon_address);
refresh(std::vector<std::string>());
success_msg_writer() <<
tools::success_msg_writer() <<
"**********************************************************************\n" <<
"Use \"help\" command to see the list of available commands.\n" <<
"**********************************************************************";
@ -451,7 +373,7 @@ bool simple_wallet::close_wallet()
bool r = m_wallet->deinit();
if (!r)
{
fail_msg_writer() << "failed to deinit wallet";
tools::fail_msg_writer() << "failed to deinit wallet";
return false;
}
@ -461,7 +383,7 @@ bool simple_wallet::close_wallet()
}
catch (const std::exception& e)
{
fail_msg_writer() << e.what();
tools::fail_msg_writer() << e.what();
return false;
}
@ -473,11 +395,11 @@ bool simple_wallet::save(const std::vector<std::string> &args)
try
{
m_wallet->store();
success_msg_writer() << "Wallet data saved";
tools::success_msg_writer() << "Wallet data saved";
}
catch (const std::exception& e)
{
fail_msg_writer() << e.what();
tools::fail_msg_writer() << e.what();
}
return true;
@ -511,7 +433,7 @@ bool simple_wallet::start_mining(const std::vector<std::string>& args)
if (!ok)
{
fail_msg_writer() << "invalid arguments. Please use start_mining [<number_of_threads>], " <<
tools::fail_msg_writer() << "invalid arguments. Please use start_mining [<number_of_threads>], " <<
"<number_of_threads> should be from 1 to " << max_mining_threads_count;
return true;
}
@ -520,9 +442,9 @@ bool simple_wallet::start_mining(const std::vector<std::string>& args)
bool r = net_utils::invoke_http_json_remote_command2(m_daemon_address + "/start_mining", req, res, m_http_client);
std::string err = interpret_rpc_response(r, res.status);
if (err.empty())
success_msg_writer() << "Mining started in daemon";
tools::success_msg_writer() << "Mining started in daemon";
else
fail_msg_writer() << "mining has NOT been started: " << err;
tools::fail_msg_writer() << "mining has NOT been started: " << err;
return true;
}
//----------------------------------------------------------------------------------------------------
@ -536,9 +458,9 @@ bool simple_wallet::stop_mining(const std::vector<std::string>& args)
bool r = net_utils::invoke_http_json_remote_command2(m_daemon_address + "/stop_mining", req, res, m_http_client);
std::string err = interpret_rpc_response(r, res.status);
if (err.empty())
success_msg_writer() << "Mining stopped in daemon";
tools::success_msg_writer() << "Mining stopped in daemon";
else
fail_msg_writer() << "mining has NOT been stopped: " << err;
tools::fail_msg_writer() << "mining has NOT been stopped: " << err;
return true;
}
//----------------------------------------------------------------------------------------------------
@ -552,9 +474,9 @@ bool simple_wallet::save_bc(const std::vector<std::string>& args)
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";
tools::success_msg_writer() << "Blockchain saved";
else
fail_msg_writer() << "Blockchain can't be saved: " << err;
tools::fail_msg_writer() << "Blockchain can't be saved: " << err;
return true;
}
//----------------------------------------------------------------------------------------------------
@ -605,7 +527,7 @@ bool simple_wallet::refresh(const std::vector<std::string>& args)
ok = true;
// Clear line "Height xxx of xxx"
std::cout << "\r \r";
success_msg_writer(true) << "Refresh done, blocks received: " << fetched_blocks;
tools::msg_writer() << "Refresh done, blocks received: " << fetched_blocks;
show_balance();
}
catch (const tools::error::daemon_busy&)
@ -644,7 +566,7 @@ bool simple_wallet::refresh(const std::vector<std::string>& args)
if (!ok)
{
fail_msg_writer() << "refresh failed: " << ss.str() << ". Blocks received: " << fetched_blocks;
tools::fail_msg_writer() << "refresh failed: " << ss.str() << ". Blocks received: " << fetched_blocks;
}
return true;
@ -652,7 +574,7 @@ bool simple_wallet::refresh(const std::vector<std::string>& args)
//----------------------------------------------------------------------------------------------------
bool simple_wallet::show_balance(const std::vector<std::string>& args/* = std::vector<std::string>()*/)
{
success_msg_writer() << "balance: " << print_money(m_wallet->balance()) << ", unlocked balance: " << print_money(m_wallet->unlocked_balance());
tools::success_msg_writer() << "balance: " << print_money(m_wallet->balance()) << ", unlocked balance: " << print_money(m_wallet->unlocked_balance());
return true;
}
//----------------------------------------------------------------------------------------------------
@ -699,15 +621,15 @@ bool simple_wallet::show_incoming_transfers(const std::vector<std::string>& args
{
if (!filter)
{
success_msg_writer() << "No incoming transfers";
tools::success_msg_writer() << "No incoming transfers";
}
else if (available)
{
success_msg_writer() << "No incoming available transfers";
tools::success_msg_writer() << "No incoming available transfers";
}
else
{
success_msg_writer() << "No incoming unavailable transfers";
tools::success_msg_writer() << "No incoming unavailable transfers";
}
}
@ -718,7 +640,7 @@ bool simple_wallet::show_payments(const std::vector<std::string> &args)
{
if(args.empty())
{
fail_msg_writer() << "expected at least one payment_id";
tools::fail_msg_writer() << "expected at least one payment_id";
return true;
}
@ -736,7 +658,7 @@ bool simple_wallet::show_payments(const std::vector<std::string> &args)
m_wallet->get_payments(payment_id, payments);
if(payments.empty())
{
success_msg_writer() << "No payments with id " << payment_id;
tools::success_msg_writer() << "No payments with id " << payment_id;
continue;
}
@ -746,7 +668,7 @@ bool simple_wallet::show_payments(const std::vector<std::string> &args)
{
payments_found = true;
}
success_msg_writer(true) <<
tools::msg_writer() <<
payment_id << '\t' <<
pd.m_tx_hash << '\t' <<
std::setw(8) << pd.m_block_height << '\t' <<
@ -756,7 +678,7 @@ bool simple_wallet::show_payments(const std::vector<std::string> &args)
}
else
{
fail_msg_writer() << "payment id has invalid format: \"" << arg << "\", expected 64-character string";
tools::fail_msg_writer() << "payment id has invalid format: \"" << arg << "\", expected 64-character string";
}
}
@ -780,9 +702,9 @@ bool simple_wallet::show_blockchain_height(const std::vector<std::string>& args)
std::string err;
uint64_t bc_height = get_daemon_blockchain_height(err);
if (err.empty())
success_msg_writer() << bc_height;
tools::success_msg_writer() << bc_height;
else
fail_msg_writer() << "failed to get blockchain height: " << err;
tools::fail_msg_writer() << "failed to get blockchain height: " << err;
return true;
}
//----------------------------------------------------------------------------------------------------
@ -794,14 +716,14 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
std::vector<std::string> local_args = args_;
if(local_args.size() < 3)
{
fail_msg_writer() << "wrong number of arguments, expected at least 3, got " << local_args.size();
tools::fail_msg_writer() << "wrong number of arguments, expected at least 3, got " << local_args.size();
return true;
}
size_t fake_outs_count;
if(!epee::string_tools::get_xtype_from_string(fake_outs_count, local_args[0]))
{
fail_msg_writer() << "mixin_count should be non-negative integer, got " << local_args[0];
tools::fail_msg_writer() << "mixin_count should be non-negative integer, got " << local_args[0];
return true;
}
local_args.erase(local_args.begin());
@ -823,7 +745,7 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
if(!r)
{
fail_msg_writer() << "payment id has invalid format: \"" << payment_id_str << "\", expected 64-character string";
tools::fail_msg_writer() << "payment id has invalid format: \"" << payment_id_str << "\", expected 64-character string";
return true;
}
}
@ -834,14 +756,14 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
cryptonote::tx_destination_entry de;
if(!get_account_address_from_str(de.addr, local_args[i]))
{
fail_msg_writer() << "wrong address: " << local_args[i];
tools::fail_msg_writer() << "wrong address: " << local_args[i];
return true;
}
bool ok = cryptonote::parse_amount(de.amount, local_args[i + 1]);
if(!ok || 0 == de.amount)
{
fail_msg_writer() << "amount is wrong: " << local_args[i] << ' ' << local_args[i + 1] <<
tools::fail_msg_writer() << "amount is wrong: " << local_args[i] << ' ' << local_args[i + 1] <<
", expected number from 0 to " << print_money(std::numeric_limits<uint64_t>::max());
return true;
}
@ -853,34 +775,34 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
{
cryptonote::transaction tx;
m_wallet->transfer(dsts, fake_outs_count, 0, DEFAULT_FEE, extra, tx);
success_msg_writer(true) << "Money successfully sent, transaction " << get_transaction_hash(tx);
tools::msg_writer() << "Money successfully sent, transaction " << get_transaction_hash(tx);
}
catch (const tools::error::daemon_busy&)
{
fail_msg_writer() << "daemon is busy. Please try later";
tools::fail_msg_writer() << "daemon is busy. Please try later";
}
catch (const tools::error::no_connection_to_daemon&)
{
fail_msg_writer() << "no connection to daemon. Please, make sure daemon is running.";
tools::fail_msg_writer() << "no connection to daemon. Please, make sure daemon is running.";
}
catch (const tools::error::wallet_rpc_error& e)
{
LOG_ERROR("Unknown RPC error: " << e.to_string());
fail_msg_writer() << "RPC error \"" << e.what() << '"';
tools::fail_msg_writer() << "RPC error \"" << e.what() << '"';
}
catch (const tools::error::get_random_outs_error&)
{
fail_msg_writer() << "failed to get random outputs to mix";
tools::fail_msg_writer() << "failed to get random outputs to mix";
}
catch (const tools::error::not_enough_money& e)
{
fail_msg_writer() << "not enough money to transfer, available only " << print_money(e.available()) <<
tools::fail_msg_writer() << "not enough money to transfer, available only " << print_money(e.available()) <<
", transaction amount " << print_money(e.tx_amount() + e.fee()) << " = " << print_money(e.tx_amount()) <<
" + " << print_money(e.fee()) << " (fee)";
}
catch (const tools::error::not_enough_outs_to_mix& e)
{
auto writer = fail_msg_writer();
auto writer = tools::fail_msg_writer();
writer << "not enough outputs for specified mixin_count = " << e.mixin_count() << ":";
for (const cryptonote::COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::outs_for_amount& outs_for_amount : e.scanty_outs())
{
@ -889,45 +811,45 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
}
catch (const tools::error::tx_not_constructed&)
{
fail_msg_writer() << "transaction was not constructed";
tools::fail_msg_writer() << "transaction was not constructed";
}
catch (const tools::error::tx_rejected& e)
{
fail_msg_writer() << "transaction " << get_transaction_hash(e.tx()) << " was rejected by daemon with status \"" << e.status() << '"';
tools::fail_msg_writer() << "transaction " << get_transaction_hash(e.tx()) << " was rejected by daemon with status \"" << e.status() << '"';
}
catch (const tools::error::tx_sum_overflow& e)
{
fail_msg_writer() << e.what();
tools::fail_msg_writer() << e.what();
}
catch (const tools::error::tx_too_big& e)
{
cryptonote::transaction tx = e.tx();
fail_msg_writer() << "transaction " << get_transaction_hash(e.tx()) << " is too big. Transaction size: " <<
tools::fail_msg_writer() << "transaction " << get_transaction_hash(e.tx()) << " is too big. Transaction size: " <<
get_object_blobsize(e.tx()) << " bytes, transaction size limit: " << e.tx_size_limit() << " bytes";
}
catch (const tools::error::zero_destination&)
{
fail_msg_writer() << "one of destinations is zero";
tools::fail_msg_writer() << "one of destinations is zero";
}
catch (const tools::error::transfer_error& e)
{
LOG_ERROR("unknown transfer error: " << e.to_string());
fail_msg_writer() << "unknown transfer error: " << e.what();
tools::fail_msg_writer() << "unknown transfer error: " << e.what();
}
catch (const tools::error::wallet_internal_error& e)
{
LOG_ERROR("internal error: " << e.to_string());
fail_msg_writer() << "internal error: " << e.what();
tools::fail_msg_writer() << "internal error: " << e.what();
}
catch (const std::exception& e)
{
LOG_ERROR("unexpected error: " << e.what());
fail_msg_writer() << "unexpected error: " << e.what();
tools::fail_msg_writer() << "unexpected error: " << e.what();
}
catch (...)
{
LOG_ERROR("Unknown error");
fail_msg_writer() << "unknown error";
tools::fail_msg_writer() << "unknown error";
}
return true;
@ -947,7 +869,7 @@ void simple_wallet::stop()
//----------------------------------------------------------------------------------------------------
bool simple_wallet::print_address(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
{
success_msg_writer() << m_wallet->get_account().get_public_address_str();
tools::success_msg_writer() << m_wallet->get_account().get_public_address_str();
return true;
}
//----------------------------------------------------------------------------------------------------
@ -997,14 +919,14 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
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();
tools::success_msg_writer() << CRYPTONOTE_NAME << " wallet v" << PROJECT_VERSION_LONG;
tools::success_msg_writer() << "Usage: simplewallet [--wallet-file=<file>|--generate-new-wallet=<file>] [--daemon-address=<host>:<port>] [<COMMAND>]";
tools::success_msg_writer() << desc_all << '\n' << w.get_commands_str();
return false;
}
else if (command_line::get_arg(vm, command_line::arg_version))
{
success_msg_writer() << CRYPTONOTE_NAME << " wallet v" << PROJECT_VERSION_LONG;
tools::success_msg_writer() << CRYPTONOTE_NAME << " wallet v" << PROJECT_VERSION_LONG;
return false;
}