diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index e27677779..e28f9ba63 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -2360,10 +2360,16 @@ namespace tools bool wallet_rpc_server::on_rescan_blockchain(const wallet_rpc::COMMAND_RPC_RESCAN_BLOCKCHAIN::request& req, wallet_rpc::COMMAND_RPC_RESCAN_BLOCKCHAIN::response& res, epee::json_rpc::error& er, const connection_context *ctx) { CHECK_IF_RESTRICTED_BACKGROUND_SYNCING(); + if (req.hard && req.keep_key_images) + { + er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR; + er.message = "Cannot preserve key images on hard rescan"; + return false; + } try { - m_wallet->rescan_blockchain(req.hard); + m_wallet->rescan_blockchain(req.hard, true, req.keep_key_images); } catch (const std::exception& e) { diff --git a/src/wallet/wallet_rpc_server_commands_defs.h b/src/wallet/wallet_rpc_server_commands_defs.h index bb087cad5..09d4ae96d 100644 --- a/src/wallet/wallet_rpc_server_commands_defs.h +++ b/src/wallet/wallet_rpc_server_commands_defs.h @@ -1220,9 +1220,11 @@ namespace wallet_rpc struct request_t { bool hard; + bool keep_key_images; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE_OPT(hard, false) + KV_SERIALIZE_OPT(keep_key_images, false) END_KV_SERIALIZE_MAP() }; typedef epee::misc_utils::struct_init request;