aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet_rpc_server.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-05 14:53:37 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-05 14:53:37 +0000
commit1965fce4026f8d97eadb3c03a97e25b0e3cc8703 (patch)
treed88208073a444c184e75161501c69df16f45da9d /src/wallet/wallet_rpc_server.cpp
parentMerge pull request #515 (diff)
downloadmonero-1965fce4026f8d97eadb3c03a97e25b0e3cc8703.tar.xz
wallet: add a stop_wallet RPC call
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet_rpc_server.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index 6c3cd2957..026b78d2e 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -628,4 +628,27 @@ namespace tools
return true;
}
+ bool wallet_rpc_server::on_stop_wallet(const wallet_rpc::COMMAND_RPC_STOP_WALLET::request& req, wallet_rpc::COMMAND_RPC_STOP_WALLET::response& res, epee::json_rpc::error& er)
+ {
+ if (m_wallet.restricted())
+ {
+ er.code = WALLET_RPC_ERROR_CODE_DENIED;
+ er.message = "Command unavailable in restricted mode.";
+ return false;
+ }
+
+ try
+ {
+ send_stop_signal();
+ m_wallet.store();
+ }
+ catch (std::exception& e)
+ {
+ er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
+ er.message = e.what();
+ return false;
+ }
+ return true;
+ }
+ //------------------------------------------------------------------------------------------------------------------------------
}