diff --git a/src/wallet/plain_wallet_api.cpp b/src/wallet/plain_wallet_api.cpp index 5e856ca4..44832c1f 100644 --- a/src/wallet/plain_wallet_api.cpp +++ b/src/wallet/plain_wallet_api.cpp @@ -265,7 +265,8 @@ namespace plain_wallet put_result(job_id, res); }; } - std::thread([async_callback]() {async_callback(); }); + std::thread t([async_callback]() {async_callback(); }); + t.detach(); LOG_PRINT_L0("[ASYNC_CALL]: started " << method_name << ", job id: " << job_id); return job_id; } diff --git a/tests/functional_tests/plain_wallet_tests.cpp b/tests/functional_tests/plain_wallet_tests.cpp index 82ccc75c..85588081 100644 --- a/tests/functional_tests/plain_wallet_tests.cpp +++ b/tests/functional_tests/plain_wallet_tests.cpp @@ -22,6 +22,17 @@ void run_plain_wallet_api_test() std::string s = plain_wallet::init("195.201.107.230", "11211"); LOG_PRINT_L0("Generating wallet..."); + view::open_wallet_request owr = AUTO_VAL_INIT(owr); + owr.path = "E:\\tmp\\zano_testwallet_745ss65030.zan"; + owr.pass = ""; + uint64_t job_id = plain_wallet::async_call("open", 0, epee::serialization::store_t_to_json(owr)); + while (true) + { + std::string res = plain_wallet::try_pull_result(job_id); + LOG_PRINT_L0("[try_pull_result] RESPONSE:" << ENDL << res); + epee::misc_utils::sleep_no_w(1000); + } + 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);