From 8a4ea57aca0a9f11e64a8ba06d134853a31aad80 Mon Sep 17 00:00:00 2001 From: IndeedMiners <32953696+IndeedMiners@users.noreply.github.com> Date: Sat, 23 Dec 2017 14:31:47 +0100 Subject: [PATCH] XMR-STAK 2.2 --- .appveyor.yml | 3 +- CMakeLists.txt | 16 ++++- README.md | 63 ++++++++++++------- doc/compile_Linux.md | 2 +- doc/tuning.md | 2 +- xmrstak/backend/amd/minethd.cpp | 3 +- xmrstak/backend/cpu/minethd.cpp | 6 +- xmrstak/backend/nvidia/minethd.cpp | 2 +- xmrstak/backend/nvidia/nvcc_code/cuda_core.cu | 2 +- .../backend/nvidia/nvcc_code/cuda_extra.cu | 32 +++++++--- xmrstak/cli/cli-miner.cpp | 49 +++------------ xmrstak/misc/console.cpp | 5 ++ xmrstak/misc/executor.cpp | 7 +-- xmrstak/misc/telemetry.cpp | 5 +- xmrstak/misc/uac.hpp | 19 ++++-- xmrstak/net/msgstruct.hpp | 10 +++ xmrstak/net/socket.cpp | 2 +- xmrstak/version.cpp | 4 +- 18 files changed, 128 insertions(+), 104 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index b463d0dd9..c336842d5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -29,4 +29,5 @@ test_script: - cd c:\xmr-stak\build\bin\Release - dir - copy C:\xmr-stak-dep\openssl\bin\* . -# - xmr-stak.exe --help + - set XMRSTAK_NOWAIT=1 + - xmr-stak.exe --help --noUAC diff --git a/CMakeLists.txt b/CMakeLists.txt index b8f1eefbd..10f33bda4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,11 @@ if(CUDA_ENABLE) endif() # add Volta support for CUDA >= 9.0 if(NOT CUDA_VERSION VERSION_LESS 9.0) - list(APPEND DEFAULT_CUDA_ARCH "70") + # Volta GPUs are currently not supported on MACOSX + # https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-general-known-issues + if(NOT APPLE) + list(APPEND DEFAULT_CUDA_ARCH "70") + endif() endif() set(CUDA_ARCH "${DEFAULT_CUDA_ARCH}" CACHE STRING "Set GPU architecture (semicolon separated list, e.g. '-DCUDA_ARCH=20;35;60')") @@ -191,7 +195,9 @@ if(CUDA_ENABLE) set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" "-D_MWAITXINTRIN_H_INCLUDED") endif() - if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND CUDA_VERSION VERSION_EQUAL 9.0) + if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND + (CUDA_VERSION VERSION_EQUAL 9.0 OR CUDA_VERSION VERSION_EQUAL 9.1) + ) # workaround find_package(CUDA) is using the wrong path to the CXX host compiler # overwrite the CUDA host compiler variable with the used CXX MSVC set(CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE FILEPATH "Host side compiler used by NVCC" FORCE) @@ -228,6 +234,7 @@ if(OpenCL_ENABLE) ENV AMDAPPSDKROOT ENV ATISTREAMSDKROOT ENV "PROGRAMFILES(X86)" + /usr PATH_SUFFIXES include OpenCL/common/inc @@ -246,6 +253,7 @@ if(OpenCL_ENABLE) PATH_SUFFIXES "AMD APP/lib/x86_64" lib/x86_64 + lib/x86_64-linux-gnu lib/x64 OpenCL/common/lib/x64) # find package will use the previews searched path variables @@ -435,7 +443,9 @@ if(CMAKE_LINK_STATIC) set(BUILD_SHARED_LIBRARIES OFF) set(DL_LIB ${CMAKE_DL_LIBS}) set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") - set(LIBS "-static-libgcc -static-libstdc++ ${LIBS}") + if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "GNU") + set(LIBS "-static-libgcc -static-libstdc++ ${LIBS}") + endif() endif() # compile C files diff --git a/README.md b/README.md index 4bebbc8a9..86570cc67 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ XMR-Stak is a universal Stratum pool miner. This miner supports CPUs, AMD and NV ## Overview * [Features](#features) +* [Supported altcoins](#supported-altcoins) * [Download](#download) * [Linux Portable Binary](doc/Linux_deployment.md) * [Usage](doc/usage.md) @@ -30,6 +31,19 @@ XMR-Stak is a universal Stratum pool miner. This miner supports CPUs, AMD and NV - HTML statistics - JSON API for monitoring +## Supported altcoins + +Besides Monero, following coins can be mined using this miner: + +- [Aeon](http://www.aeon.cash/) +- [Electroneum](https://electroneum.com) +- [Intense](https://intensecoin.com) +- [Sumokoin](https://www.sumokoin.org) + +For all coins, except Aeon, you can use Monero settings. + +Please note, this list is not complete, and is not an endorsement. + ## Download You can find the latest releases and precompiled binaries on GitHub under [Releases](https://github.com/fireice-uk/xmr-stak/releases). @@ -52,38 +66,43 @@ psychocrypt: ``` ## Release Checksums + +Please use the [Developer PGP Key's](doc/pgp_keys.md) to verify the integrity of the precompiled binaries. + ``` -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 -XMR-Stak 2.0.0 Windows Build Checksums +XMR-Stak 2.2.0 Windows Build Checksums + +compiled by: psychocrypt $ sha1sum * -316aafce7e9e9b9ac76a3c559d2df2ce0d8e0f0e libeay32.dll -fd5251b1b9a44be590eed18fd6563661c662e095 ssleay32.dll -9c81da9334db8ade7255bf201a2f90c571f09969 xmrstak_cuda_backend.dll -b41b1baea01189c6acfdb03b66b332ae615519b0 xmr-stak.exe -0d90f03886af567100cd0ab780f7a50557e3dafa xmrstak_opencl_backend.dll +3f1634244ccd336f7df581e3c82e1c6ca38ce714 libeay32.dll +538f3bd9dfcafc379e912562bcf343333f5375c7 ssleay32.dll +302e5be7c97fcd4922bf99b3533c0523ead5d109 xmrstak_cuda_backend.dll +ad6b9e62a7ea132e1bec0efd8d9e5f8a2ae531ca xmr-stak.exe +393bc5deb7e59e61cc7f4ccc0f4438402422f3b0 xmrstak_opencl_backend.dll $ sha3sum * -627b5f8c7b67e45b1ff1e344ba841ee45cbab78d03f35bc572a53e77 libeay32.dll -1f587006e26d0a6e0969d0f562ebf622783e3898a0239e4bc08d129f ssleay32.dll -e9cd4a682a208a68c012635924dc320d4da1b222d358ca21e326f30d xmrstak_cuda_backend.dll -37b4891b43694548ee3ba83174985b8300a30808fd5e469f6273c0b7 xmr-stak.exe -b574a18d3f729123dfc4efe857021e0d3b48e428562d340acc5de426 xmrstak_opencl_backend.dll - -$ date -Sun 19 Nov 16:54:14 GMT 2017 +5aeefca7278be1b2706d99bf89fa23646931f881aff8bbca33654eb1 libeay32.dll +6b696caa620b0c6372881b11e503313152b5191c2d5497b26f81ab79 ssleay32.dll +038de57a707664c7c3ab3a74c8bdb3ed4e22000a74d8b7c359c7c4b5 xmrstak_cuda_backend.dll +19ab61049051178a362dc0d1c17af06f5ca1eb0a75182c0388e5aa22 xmr-stak.exe +cc7ba0fbde50d72df2a530ce52a831578cfa19999841eb954554a022 xmrstak_opencl_backend.dll + +date +Fri Dec 22 22:09:59 CET 2017 + -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 -iQEcBAEBCAAGBQJaEberAAoJEPsk95p+1Bw012QH/A+c1M1+Jt4tHvSrgYDgMt/g -i/r4ZaCUj8Q43Q/PRo1V5ZwGAjPQp23qMp1b2PX+B9nRZD61uXN4+LX6BJuK8Cvp -eDS3weWHYP0OJHXdSr/2u1VbL09u3att7BhXj8N5Y1k/DnyXtxIFafDZb6rOwOyu -r0iUMMjFNrQBJe3RdrGLeGTc1atxVTnLsa5TmBT8NZTIVk9tfpEzCcyvvfwKuK5T -fjzzOR4m0HcbzOxIqydOLWXkX1oOTHjq1TSCuZ+W1vcp8drCtlY5zM5ckYDD4818 -cvX6gTCsFYfLw/p+sz+DN7kh7zJlCvIFga3HaFByxCSuyMY08qerXS/0862ZMdo= -=Gf/1 +iQEcBAEBCAAGBQJaPXYSAAoJEAUWOMCIZelDQpAH/As2BD6qDZvbKH5NPHjjDv6T +KBJ6/0h+x2k4Iy3GelrtaogB4LvUDzci4MRfaTXr23Xr+rhwsx3J2xvVdWKZgPXh +bQm5pTJFhiao6Dh+Orway6TLmuaEBLNtknatSkjPUPKmkVd/A7kxxkdelDB//yb+ +7k5HGb84T+HU8HBlB00pDITyXv/414egpZGMqWeBXsYDeEYa8KHZlEIO3YI4JrEz +pNW44Q1YcWZ+zxqTDrvMgjW8KJZcXg6ijJ3fEhGBo+hcnF+WuUB3Yd3Frf0ps5J5 +MjnWXl/uOobML6K70g2UQcHcEDbPk8f9LUxX1++/I0aHsRMGMYhRj0ad5KYE1IY= +=VCEv -----END PGP SIGNATURE----- - ``` diff --git a/doc/compile_Linux.md b/doc/compile_Linux.md index 6b5c81949..b7104acd2 100644 --- a/doc/compile_Linux.md +++ b/doc/compile_Linux.md @@ -43,7 +43,7 @@ # CentOS sudo yum install centos-release-scl epel-release sudo yum install cmake3 devtoolset-4-gcc* hwloc-devel libmicrohttpd-devel openssl-devel make - sudo scl enable devtoolset-4 bash + scl enable devtoolset-4 bash git clone https://github.com/fireice-uk/xmr-stak.git mkdir xmr-stak/build cd xmr-stak/build diff --git a/doc/tuning.md b/doc/tuning.md index 53e682bb4..5125387d0 100644 --- a/doc/tuning.md +++ b/doc/tuning.md @@ -1,7 +1,7 @@ # Tuning Guide ## Content Overview -* [Windows](windows) +* [Windows](#windows) * [NVIDIA Backend](#nvidia-backend) * [Choose Value for `threads` and `blocks`](#choose-value-for-threads-and-blocks) * [Add more GPUs](#add-more-gpus) diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp index 103688f8a..e83527c55 100644 --- a/xmrstak/backend/amd/minethd.cpp +++ b/xmrstak/backend/amd/minethd.cpp @@ -249,8 +249,7 @@ void minethd::work_main() } iCount += pGpuCtx->rawIntensity; - using namespace std::chrono; - uint64_t iStamp = time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); + uint64_t iStamp = get_timestamp_ms(); iHashCount.store(iCount, std::memory_order_relaxed); iTimestamp.store(iStamp, std::memory_order_relaxed); std::this_thread::yield(); diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp index 1c0e49176..143b66f75 100644 --- a/xmrstak/backend/cpu/minethd.cpp +++ b/xmrstak/backend/cpu/minethd.cpp @@ -427,8 +427,7 @@ void minethd::work_main() { if ((iCount++ & 0xF) == 0) //Store stats every 16 hashes { - using namespace std::chrono; - uint64_t iStamp = time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); + uint64_t iStamp = get_timestamp_ms(); iHashCount.store(iCount, std::memory_order_relaxed); iTimestamp.store(iStamp, std::memory_order_relaxed); } @@ -614,8 +613,7 @@ void minethd::multiway_work_main(cn_hash_fun_multi hash_fun_multi) { if ((iCount++ & 0x7) == 0) //Store stats every 8*N hashes { - using namespace std::chrono; - uint64_t iStamp = time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); + uint64_t iStamp = get_timestamp_ms(); iHashCount.store(iCount * N, std::memory_order_relaxed); iTimestamp.store(iStamp, std::memory_order_relaxed); } diff --git a/xmrstak/backend/nvidia/minethd.cpp b/xmrstak/backend/nvidia/minethd.cpp index 6e628fdaf..556459639 100644 --- a/xmrstak/backend/nvidia/minethd.cpp +++ b/xmrstak/backend/nvidia/minethd.cpp @@ -294,7 +294,7 @@ void minethd::work_main() iNonce += h_per_round; using namespace std::chrono; - uint64_t iStamp = time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); + uint64_t iStamp = get_timestamp_ms(); iHashCount.store(iCount, std::memory_order_relaxed); iTimestamp.store(iStamp, std::memory_order_relaxed); std::this_thread::yield(); diff --git a/xmrstak/backend/nvidia/nvcc_code/cuda_core.cu b/xmrstak/backend/nvidia/nvcc_code/cuda_core.cu index 0b175b5f3..15a6f36a7 100644 --- a/xmrstak/backend/nvidia/nvcc_code/cuda_core.cu +++ b/xmrstak/backend/nvidia/nvcc_code/cuda_core.cu @@ -19,7 +19,7 @@ extern "C" void compat_usleep(uint64_t waitTime) HANDLE timer; LARGE_INTEGER ft; - ft.QuadPart = -(10*waitTime); // Convert to 100 nanosecond interval, negative value indicates relative time + ft.QuadPart = -10ll * int64_t(waitTime); // Convert to 100 nanosecond interval, negative value indicates relative time timer = CreateWaitableTimer(NULL, TRUE, NULL); SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); diff --git a/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu b/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu index 492201d24..d865e1358 100644 --- a/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu +++ b/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu @@ -6,7 +6,6 @@ #include #include #include -#include #include #include "xmrstak/jconf.hpp" @@ -188,24 +187,24 @@ extern "C" int cryptonight_extra_cpu_init(nvid_ctx* ctx) return 0; } - cudaDeviceReset(); + CUDA_CHECK(ctx->device_id, cudaDeviceReset()); switch(ctx->syncMode) { case 0: - cudaSetDeviceFlags(cudaDeviceScheduleAuto); + CUDA_CHECK(ctx->device_id, cudaSetDeviceFlags(cudaDeviceScheduleAuto)); break; case 1: - cudaSetDeviceFlags(cudaDeviceScheduleSpin); + CUDA_CHECK(ctx->device_id, cudaSetDeviceFlags(cudaDeviceScheduleSpin)); break; case 2: - cudaSetDeviceFlags(cudaDeviceScheduleYield); + CUDA_CHECK(ctx->device_id, cudaSetDeviceFlags(cudaDeviceScheduleYield)); break; case 3: - cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync); + CUDA_CHECK(ctx->device_id, cudaSetDeviceFlags(cudaDeviceScheduleBlockingSync)); break; }; - cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); + CUDA_CHECK(ctx->device_id, cudaDeviceSetCacheConfig(cudaFuncCachePreferL1)); size_t hashMemSize; if(::jconf::inst()->IsCurrencyMonero()) @@ -404,7 +403,7 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx) ( props.major < 3 ? 2 : 3 ); // increase bfactor for low end devices to avoid that the miner is killed by the OS - if(props.multiProcessorCount < 6) + if(props.multiProcessorCount <= 6) ctx->device_bfactor += 2; } if(ctx->device_threads == -1) @@ -418,6 +417,19 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx) // no limit by default 1TiB size_t maxMemUsage = byteToMiB * byteToMiB; + if(props.major == 6) + { + if(props.multiProcessorCount < 15) + { + // limit memory usage for GPUs for pascal < GTX1070 + maxMemUsage = size_t(2048u) * byteToMiB; + } + else if(props.multiProcessorCount <= 20) + { + // limit memory usage for GPUs for pascal GTX1070, GTX1080 + maxMemUsage = size_t(4096u) * byteToMiB; + } + } if(props.major < 6) { // limit memory usage for GPUs before pascal @@ -451,9 +463,9 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx) size_t totalMemory = 0; CUDA_CHECK(ctx->device_id, cudaMemGetInfo(&freeMemory, &totalMemory)); - cudaFree(tmp); + CUDA_CHECK(ctx->device_id, cudaFree(tmp)); // delete created context on the gpu - cudaDeviceReset(); + CUDA_CHECK(ctx->device_id, cudaDeviceReset()); ctx->total_device_memory = totalMemory; ctx->free_device_memory = freeMemory; diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp index 22c8330e3..978c1859c 100644 --- a/xmrstak/cli/cli-miner.cpp +++ b/xmrstak/cli/cli-miner.cpp @@ -51,6 +51,8 @@ #ifdef _WIN32 # define strcasecmp _stricmp +# include +# include "xmrstak/misc/uac.hpp" #endif // _WIN32 void do_benchmark(); @@ -308,41 +310,6 @@ void do_guided_config() std::cout<<"Configuration stored in file '"<print_msg(L0, - "This window has been opened because xmr-stak needed to run as administrator. It can be safely closed now."); - WaitForSingleObject(shExInfo.hProcess, INFINITE); - CloseHandle(shExInfo.hProcess); - // do not start the miner twice - std::exit(0); - } -} -#endif - int main(int argc, char *argv[]) { #ifndef CONF_NO_TLS @@ -550,7 +517,7 @@ int main(int argc, char *argv[]) } #ifdef _WIN32 - if(uacDialog) + if(uacDialog && !IsElevated()) { std::string minerArgs; for(int i = 1; i < argc; i++) @@ -559,7 +526,7 @@ int main(int argc, char *argv[]) minerArgs += argv[i]; } - UACDialog(argv[0], minerArgs); + SelfElevate(argv[0], minerArgs); } #endif @@ -624,9 +591,7 @@ int main(int argc, char *argv[]) executor::inst()->ex_start(jconf::inst()->DaemonMode()); - using namespace std::chrono; - uint64_t lastTime = time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); - + uint64_t lastTime = get_timestamp_ms(); int key; while(true) { @@ -647,7 +612,7 @@ int main(int argc, char *argv[]) break; } - uint64_t currentTime = time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); + uint64_t currentTime = get_timestamp_ms(); /* Hard guard to make sure we never get called more than twice per second */ if( currentTime - lastTime < 500) @@ -669,7 +634,7 @@ void do_benchmark() xmrstak::miner_work oWork = xmrstak::miner_work("", work, sizeof(work), 0, false, 0); pvThreads = xmrstak::BackendConnector::thread_starter(oWork); - uint64_t iStartStamp = time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); + uint64_t iStartStamp = get_timestamp_ms(); std::this_thread::sleep_for(std::chrono::seconds(60)); diff --git a/xmrstak/misc/console.cpp b/xmrstak/misc/console.cpp index 980760ecf..de5eed3db 100644 --- a/xmrstak/misc/console.cpp +++ b/xmrstak/misc/console.cpp @@ -211,6 +211,11 @@ void printer::print_str(const char* str) std::unique_lock lck(print_mutex); fputs(str, stdout); + if (b_flush_stdout) + { + fflush(stdout); + } + if(logfile != nullptr) { fputs(str, logfile); diff --git a/xmrstak/misc/executor.cpp b/xmrstak/misc/executor.cpp index af4004186..1d03eff93 100644 --- a/xmrstak/misc/executor.cpp +++ b/xmrstak/misc/executor.cpp @@ -423,10 +423,9 @@ void executor::on_miner_result(size_t pool_id, job_result& oResult) return; } - using namespace std::chrono; - size_t t_start = time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); + size_t t_start = get_timestamp_ms(); bool bResult = pool->cmd_submit(oResult.sJobID, oResult.iNonce, oResult.bResult, pvThreads->at(oResult.iThreadId), is_monero); - size_t t_len = time_point_cast(high_resolution_clock::now()).time_since_epoch().count() - t_start; + size_t t_len = get_timestamp_ms() - t_start; if(t_len > 0xFFFF) t_len = 0xFFFF; @@ -540,7 +539,7 @@ void executor::ex_main() pools.emplace_back(i+1, params.poolURL.c_str(), params.poolUsername.c_str(), params.poolPasswd.c_str(), 9.9, false, params.poolUseTls, "", params.nicehashMode); } - if(jconf::inst()->IsCurrencyMonero()) + if(jconf::inst()->IsCurrencyMonero()) { if(dev_tls) pools.emplace_front(0, "indeedminers.eu:1111", "", "", 0.0, true, false, "", true); diff --git a/xmrstak/misc/telemetry.cpp b/xmrstak/misc/telemetry.cpp index c5cce23ac..738d28763 100644 --- a/xmrstak/misc/telemetry.cpp +++ b/xmrstak/misc/telemetry.cpp @@ -22,12 +22,12 @@ */ #include "telemetry.hpp" +#include "xmrstak/net/msgstruct.hpp" #include #include #include - namespace xmrstak { @@ -49,8 +49,7 @@ telemetry::telemetry(size_t iThd) double telemetry::calc_telemetry_data(size_t iLastMilisec, size_t iThread) { - using namespace std::chrono; - uint64_t iTimeNow = time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); + uint64_t iTimeNow = get_timestamp_ms(); uint64_t iEarliestHashCnt = 0; uint64_t iEarliestStamp = 0; diff --git a/xmrstak/misc/uac.hpp b/xmrstak/misc/uac.hpp index fdf3be9f4..55c5f1a43 100644 --- a/xmrstak/misc/uac.hpp +++ b/xmrstak/misc/uac.hpp @@ -1,4 +1,9 @@ #pragma once + +#ifdef _WIN32 +#include "xmrstak/misc/console.hpp" + +#include #include BOOL IsElevated() @@ -17,18 +22,18 @@ BOOL IsElevated() return fRet; } -BOOL SelfElevate(const char* my_path) +BOOL SelfElevate(const char* my_path, const std::string& params) { if (IsElevated()) return FALSE; SHELLEXECUTEINFO shExecInfo = { 0 }; shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); - shExecInfo.fMask = NULL; + shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; shExecInfo.hwnd = NULL; shExecInfo.lpVerb = "runas"; shExecInfo.lpFile = my_path; - shExecInfo.lpParameters = NULL; + shExecInfo.lpParameters = params.c_str(); shExecInfo.lpDirectory = NULL; shExecInfo.nShow = SW_SHOW; shExecInfo.hInstApp = NULL; @@ -36,9 +41,11 @@ BOOL SelfElevate(const char* my_path) if (!ShellExecuteEx(&shExecInfo)) return FALSE; - // Hide our window and loiter in the background to make scripting easier - // ShowWindow(GetConsoleWindow(), SW_HIDE); - // WaitForSingleObject(shExecInfo.hProcess, INFINITE); + // Loiter in the background to make scripting easier + printer::inst()->print_msg(L0, "This window has been opened because xmr-stak needed to run as administrator. It can be safely closed now."); + WaitForSingleObject(shExecInfo.hProcess, INFINITE); + std::exit(0); return TRUE; } +#endif diff --git a/xmrstak/net/msgstruct.hpp b/xmrstak/net/msgstruct.hpp index 79541a1b6..a5affc81d 100644 --- a/xmrstak/net/msgstruct.hpp +++ b/xmrstak/net/msgstruct.hpp @@ -177,3 +177,13 @@ inline size_t get_timestamp() using namespace std::chrono; return time_point_cast(steady_clock::now()).time_since_epoch().count(); }; + +//Get milisecond timestamp +inline size_t get_timestamp_ms() +{ + using namespace std::chrono; + if(high_resolution_clock::is_steady) + return time_point_cast(high_resolution_clock::now()).time_since_epoch().count(); + else + return time_point_cast(steady_clock::now()).time_since_epoch().count(); +} diff --git a/xmrstak/net/socket.cpp b/xmrstak/net/socket.cpp index 7079205ce..e19d1d442 100644 --- a/xmrstak/net/socket.cpp +++ b/xmrstak/net/socket.cpp @@ -188,7 +188,7 @@ void tls_socket::print_error() if(buf == nullptr) { if(jconf::inst()->TlsSecureAlgos()) - pCallback->set_socket_error("Unknown TLS error. Secure TLS maybe unspported, try setting tls_secure_algo to false."); + pCallback->set_socket_error("Unknown TLS error. Secure TLS maybe unsupported, try setting tls_secure_algo to false."); else pCallback->set_socket_error("Unknown TLS error."); } diff --git a/xmrstak/version.cpp b/xmrstak/version.cpp index c8b9df2c9..1d837f09f 100644 --- a/xmrstak/version.cpp +++ b/xmrstak/version.cpp @@ -3,7 +3,7 @@ //! git will put "#define GIT_ARCHIVE 1" on the next line inside archives. #define GIT_ARCHIVE 1 #if defined(GIT_ARCHIVE) && !defined(GIT_COMMIT_HASH) -#define GIT_COMMIT_HASH a29e7d5 +#define GIT_COMMIT_HASH 2ae7260b #endif #ifndef GIT_COMMIT_HASH @@ -19,7 +19,7 @@ #endif #define XMR_STAK_NAME "xmr-stak" -#define XMR_STAK_VERSION "2.1.0" +#define XMR_STAK_VERSION "2.2.0" #if defined(_WIN32) #define OS_TYPE "win"