diff options
| author | Justin Berman <justinberman@protonmail.com> | 2025-06-26 17:32:12 +0000 |
|---|---|---|
| committer | nahuhh <50635951+nahuhh@users.noreply.github.com> | 2025-07-07 22:21:43 +0000 |
| commit | e23d51bc1683e4aa369ba0f2889b96113eeb4e3a (patch) | |
| tree | e5c6ae3a60d2fdfc03938a4dcaa6efb84ad234f5 /src/wallet/wallet_rpc_server.cpp | |
| parent | 678f5dab31aa27c9e6e1fb24a4c1f683ef242e1a (diff) | |
| download | monzero-core-e23d51bc1683e4aa369ba0f2889b96113eeb4e3a.tar.gz monzero-core-e23d51bc1683e4aa369ba0f2889b96113eeb4e3a.tar.xz monzero-core-e23d51bc1683e4aa369ba0f2889b96113eeb4e3a.zip | |
wallet: improve lookahead logic & make rpc persistent
Diffstat (limited to 'src/wallet/wallet_rpc_server.cpp')
| -rw-r--r-- | src/wallet/wallet_rpc_server.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 37e0968b8..15ca1500e 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -653,11 +653,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; |
