diff options
| author | tobtoht <tob@featherwallet.org> | 2025-07-10 12:19:42 +0000 |
|---|---|---|
| committer | tobtoht <tob@featherwallet.org> | 2025-07-10 12:19:42 +0000 |
| commit | 8b4f0a6258af26b978b85a1fa1bd0ee8244de3de (patch) | |
| tree | 6d4fa72191edfdd028228d04e5f2688648757b03 /src/wallet/wallet_rpc_server.cpp | |
| parent | f1ffcc5c497c8b5475eab4a9ff53b21e21f58d50 (diff) | |
| parent | 1da19dac545bb5c0521949a212af42a7f351776e (diff) | |
| download | monzero-core-8b4f0a6258af26b978b85a1fa1bd0ee8244de3de.tar.gz monzero-core-8b4f0a6258af26b978b85a1fa1bd0ee8244de3de.tar.xz monzero-core-8b4f0a6258af26b978b85a1fa1bd0ee8244de3de.zip | |
Merge pull request #9954
1da19da wallet: refactor subaddress expansion & add to transfer test (jeffro256)
e23d51b wallet: improve lookahead logic & make rpc persistent (Justin Berman)
678f5da wallet: create set_subaddress_lookahead wallet rpc endpoint (benevanoff)
8f5a7b0 wallet: ensure subaddress keys table is at least size of requested lookahead (benevanoff)
Diffstat (limited to 'src/wallet/wallet_rpc_server.cpp')
| -rw-r--r-- | src/wallet/wallet_rpc_server.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 32017c5c1..020b16fb8 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -702,6 +702,31 @@ namespace tools res.index = *index; return true; } + 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); + 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; + } + } + else + { + er.code = WALLET_RPC_ERROR_CODE_INVALID_PASSWORD; + er.message = "Invalid password."; + return false; + } + return true; + } //------------------------------------------------------------------------------------------------------------------------------ bool wallet_rpc_server::on_create_address(const wallet_rpc::COMMAND_RPC_CREATE_ADDRESS::request& req, wallet_rpc::COMMAND_RPC_CREATE_ADDRESS::response& res, epee::json_rpc::error& er, const connection_context *ctx) { |
