mirror of
https://github.com/monero-project/monero.git
synced 2025-08-08 14:12:29 -04:00
wallet: improve lookahead logic & make rpc persistent
This commit is contained in:
parent
6f36037116
commit
6e26e4477e
5 changed files with 147 additions and 31 deletions
|
@ -707,11 +707,24 @@ namespace tools
|
|||
bool wallet_rpc_server::on_set_subaddr_lookahead(const wallet_rpc::COMMAND_RPC_SET_SUBADDR_LOOKAHEAD::request& req, wallet_rpc::COMMAND_RPC_SET_SUBADDR_LOOKAHEAD::response& res, epee::json_rpc::error& er, const connection_context *ctx)
|
||||
{
|
||||
if (!m_wallet) return not_open(er);
|
||||
try {
|
||||
m_wallet->set_subaddress_lookahead(req.major_idx, req.minor_idx);
|
||||
CHECK_IF_BACKGROUND_SYNCING();
|
||||
const std::string wallet_file = m_wallet->get_wallet_file();
|
||||
if (wallet_file == "" || m_wallet->verify_password(req.password))
|
||||
{
|
||||
try
|
||||
{
|
||||
m_wallet->set_subaddress_lookahead(req.major_idx, req.minor_idx);
|
||||
m_wallet->rewrite(wallet_file, req.password);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
handle_rpc_exception(std::current_exception(), er, WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
handle_rpc_exception(std::current_exception(), er, WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR);
|
||||
else
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_INVALID_PASSWORD;
|
||||
er.message = "Invalid password.";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue