Merge pull request #4242

6fcdc9e rpc-wallet: refresh command added (ph4r05)
This commit is contained in:
luigi1111 2018-08-22 21:00:10 -05:00
commit 2e7bfd0de5
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
3 changed files with 47 additions and 0 deletions

View file

@ -2507,6 +2507,28 @@ namespace tools
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
bool wallet_rpc_server::on_refresh(const wallet_rpc::COMMAND_RPC_REFRESH::request& req, wallet_rpc::COMMAND_RPC_REFRESH::response& res, epee::json_rpc::error& er)
{
if (!m_wallet) return not_open(er);
if (m_restricted)
{
er.code = WALLET_RPC_ERROR_CODE_DENIED;
er.message = "Command unavailable in restricted mode.";
return false;
}
try
{
m_wallet->refresh(m_trusted_daemon, req.start_height, res.blocks_fetched, res.received_money);
return true;
}
catch (const std::exception& e)
{
handle_rpc_exception(std::current_exception(), er, WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR);
return false;
}
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
bool wallet_rpc_server::on_rescan_spent(const wallet_rpc::COMMAND_RPC_RESCAN_SPENT::request& req, wallet_rpc::COMMAND_RPC_RESCAN_SPENT::response& res, epee::json_rpc::error& er)
{
if (!m_wallet) return not_open(er);