diff --git a/src/wallet/plain_wallet_api.cpp b/src/wallet/plain_wallet_api.cpp index 014f1a9d..dd06f183 100644 --- a/src/wallet/plain_wallet_api.cpp +++ b/src/wallet/plain_wallet_api.cpp @@ -28,7 +28,7 @@ namespace plain_wallet std::string get_bundle_root_dir() { #ifdef WIN32 - return "undefined"; + return ""; #endif // WIN32 char buffer[1000] = {0}; @@ -38,7 +38,10 @@ namespace plain_wallet std::string get_wallets_folder() { - std::string path = get_bundle_root_dir() + "/" + HOME_FOLDER + "/" + WALLETS_FOLDER_NAME; +#ifdef WIN32 + return ""; +#endif // WIN32 + std::string path = get_bundle_root_dir() + "/" + HOME_FOLDER + "/" + WALLETS_FOLDER_NAME + "/"; return path; } @@ -115,7 +118,7 @@ namespace plain_wallet std::string open(const std::string& path, const std::string& password) { - std::string full_path = get_wallets_folder() + "/" + path; + std::string full_path = get_wallets_folder() + path; epee::json_rpc::response ok_response = AUTO_VAL_INIT(ok_response); std::string rsp = gwm.open_wallet(epee::string_encoding::convert_to_unicode(full_path), password, 20, ok_response.result); if (rsp == API_RETURN_CODE_OK || rsp == API_RETURN_CODE_FILE_RESTORED) @@ -124,6 +127,8 @@ namespace plain_wallet { ok_response.result.recovered = true; } + gwm.run_wallet(ok_response.result.wallet_id); + return epee::serialization::store_t_to_json(ok_response); } error_response err_result = AUTO_VAL_INIT(err_result); @@ -132,7 +137,7 @@ namespace plain_wallet } std::string restore(const std::string& seed, const std::string& path, const std::string& password) { - std::string full_path = get_wallets_folder() + "/" + path; + std::string full_path = get_wallets_folder() + path; epee::json_rpc::response ok_response = AUTO_VAL_INIT(ok_response); std::string rsp = gwm.restore_wallet(epee::string_encoding::convert_to_unicode(full_path), password, seed, ok_response.result); if (rsp == API_RETURN_CODE_OK || rsp == API_RETURN_CODE_FILE_RESTORED) @@ -150,7 +155,7 @@ namespace plain_wallet std::string generate(const std::string& path, const std::string& password) { - std::string full_path = get_wallets_folder() + "/" + path; + std::string full_path = get_wallets_folder() + path; epee::json_rpc::response ok_response = AUTO_VAL_INIT(ok_response); std::string rsp = gwm.generate_wallet(epee::string_encoding::convert_to_unicode(full_path), password, ok_response.result); if (rsp == API_RETURN_CODE_OK || rsp == API_RETURN_CODE_FILE_RESTORED) diff --git a/src/wallet/wallets_manager.cpp b/src/wallet/wallets_manager.cpp index 4dd2e046..9da7eaf6 100644 --- a/src/wallet/wallets_manager.cpp +++ b/src/wallet/wallets_manager.cpp @@ -1616,7 +1616,7 @@ void wallets_manager::wallet_vs_options::worker_func() if (last_wallet_synch_height && *plast_daemon_height - last_wallet_synch_height < 3) show_progress = false; - if(last_wallet_synch_height && *plast_daemon_height - last_wallet_synch_height > 10) + if(*plast_daemon_height - last_wallet_synch_height > 10) { CRITICAL_REGION_LOCAL(long_refresh_in_progress_lock); long_refresh_in_progress = true; diff --git a/tests/functional_tests/plain_wallet_tests.cpp b/tests/functional_tests/plain_wallet_tests.cpp index caf30eec..82ccc75c 100644 --- a/tests/functional_tests/plain_wallet_tests.cpp +++ b/tests/functional_tests/plain_wallet_tests.cpp @@ -19,7 +19,28 @@ using namespace epee; void run_plain_wallet_api_test() { LOG_PRINT_L0("Creating instance..."); - std::string s = plain_wallet::init("127.0.0.1", "11211"); + std::string s = plain_wallet::init("195.201.107.230", "11211"); + + LOG_PRINT_L0("Generating wallet..."); + std::string rsp = plain_wallet::open(std::string("E:\\tmp\\zano_testwallet_745ss65030.zan"), ""); + LOG_PRINT_L0("RESPONSE:" << ENDL << rsp); + epee::json_rpc::response ok_response = AUTO_VAL_INIT(ok_response); + epee::serialization::load_t_from_json(ok_response, rsp); + + + while (true) + { + std::string prog = plain_wallet::get_wallet_status(ok_response.result.wallet_id); + LOG_PRINT_L0("Progress: " << ENDL << prog); + // view::sta ssr = AUTO_VAL_INIT(ssr); + // epee::serialization::load_t_from_json(ssr, prog); + // LOG_PRINT_L0("Progress: " << ssr.progress << "Finished: " << ssr.finished); + // if (ssr.finished) + // break; + epee::misc_utils::sleep_no_w(1000); + } +} + // LOG_PRINT_L0("Creating instance..." << std::hex << hw); // // LOG_PRINT_L0("Generating wallet..."); @@ -157,5 +178,4 @@ void run_plain_wallet_api_test() // LOG_PRINT_L0("Balance request returned: code [" << gbres.error.code << "], str_response: " // << ENDL << res); // } -// } -} \ No newline at end of file +// }} \ No newline at end of file