wallet: add a stop_wallet RPC call

This commit is contained in:
moneromooo-monero
2015-12-05 14:53:37 +00:00
parent 2bed53cb6b
commit 1965fce402
3 changed files with 40 additions and 0 deletions

View File

@@ -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;
}
//------------------------------------------------------------------------------------------------------------------------------
}