aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authorNeozaru <neozaru@mailoo.org>2014-05-16 00:21:43 +0200
committerNeozaru <neozaru@mailoo.org>2014-05-16 00:21:43 +0200
commit46906700318c5361f0e04a7639bfe2ba01b7564c (patch)
tree30d1f1908bbd41f6e8afb05116c180dcc93a7a6a /src/simplewallet/simplewallet.cpp
parentMerge pull request #10 from NoodleDoodleNoodleDoodleNoodleDoodleNoo/patch-8 (diff)
downloadmonero-46906700318c5361f0e04a7639bfe2ba01b7564c.tar.xz
Added 'save_bc' command in daemon for saving blockchain remotely
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r--src/simplewallet/simplewallet.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 919782ab6..0f84b81de 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -181,6 +181,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 +492,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);