aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-29 22:03:52 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-04-11 10:46:41 +0000
commit9f8dc4ce515f52ebb2a434ba6d1d9f47bfeac612 (patch)
tree7c73227be570f59685f1c3efb4d313c0831aa9f6 /src/simplewallet
parentMerge pull request #5367 (diff)
downloadmonero-9f8dc4ce515f52ebb2a434ba6d1d9f47bfeac612.tar.xz
simplewallet: new net_stats command
displays total sent and received bytes
Diffstat (limited to 'src/simplewallet')
-rw-r--r--src/simplewallet/simplewallet.cpp12
-rw-r--r--src/simplewallet/simplewallet.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 9f7cc9c3b..736d5391e 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -242,6 +242,7 @@ namespace
const char* USAGE_FREEZE("freeze <key_image>");
const char* USAGE_THAW("thaw <key_image>");
const char* USAGE_FROZEN("frozen <key_image>");
+ const char* USAGE_NET_STATS("net_stats");
const char* USAGE_VERSION("version");
const char* USAGE_HELP("help [<command>]");
@@ -2098,6 +2099,13 @@ bool simple_wallet::frozen(const std::vector<std::string> &args)
return true;
}
+bool simple_wallet::net_stats(const std::vector<std::string> &args)
+{
+ message_writer() << std::to_string(m_wallet->get_bytes_sent()) + tr(" bytes sent");
+ message_writer() << std::to_string(m_wallet->get_bytes_received()) + tr(" bytes received");
+ return true;
+}
+
bool simple_wallet::version(const std::vector<std::string> &args)
{
message_writer() << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")";
@@ -3097,6 +3105,10 @@ simple_wallet::simple_wallet()
boost::bind(&simple_wallet::frozen, this, _1),
tr(USAGE_FROZEN),
tr("Checks whether a given output is currently frozen by key image"));
+ m_cmd_binder.set_handler("net_stats",
+ boost::bind(&simple_wallet::net_stats, this, _1),
+ tr(USAGE_NET_STATS),
+ tr("Prints simple network stats"));
m_cmd_binder.set_handler("version",
boost::bind(&simple_wallet::version, this, _1),
tr(USAGE_VERSION),
diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h
index c9a5c55e8..b2dcebb18 100644
--- a/src/simplewallet/simplewallet.h
+++ b/src/simplewallet/simplewallet.h
@@ -241,6 +241,7 @@ namespace cryptonote
bool freeze(const std::vector<std::string>& args);
bool thaw(const std::vector<std::string>& args);
bool frozen(const std::vector<std::string>& args);
+ bool net_stats(const std::vector<std::string>& args);
bool version(const std::vector<std::string>& args);
bool cold_sign_tx(const std::vector<tools::wallet2::pending_tx>& ptx_vector, tools::wallet2::signed_tx_set &exported_txs, std::vector<cryptonote::address_parse_info> &dsts_info, std::function<bool(const tools::wallet2::signed_tx_set &)> accept_func);