diff options
author | monero-project <sempre.amaro@gmail.com> | 2014-05-15 18:47:12 -0400 |
---|---|---|
committer | monero-project <sempre.amaro@gmail.com> | 2014-05-15 18:47:12 -0400 |
commit | dda8b3432bc853463fcdd80c36f436be1a9f5d4f (patch) | |
tree | ddf6c47c1ef7c647fe68789c79fa4b773bfd1c38 /src/simplewallet/simplewallet.cpp | |
parent | Merge pull request #10 from NoodleDoodleNoodleDoodleNoodleDoodleNoo/patch-8 (diff) | |
parent | Added 'save_bc' command in daemon for saving blockchain remotely (diff) | |
download | monero-dda8b3432bc853463fcdd80c36f436be1a9f5d4f.tar.xz |
Merge pull request #11 from Neozaru/master
'save_bc' command for requesting blockchain saving remotely
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 17 |
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); |