From 75ae1dd60165141700c36ab699656e9e073e186d Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Thu, 5 Apr 2018 23:19:48 -0600 Subject: Repair all 'namepsace' to 'namespace' (all within comments) --- xmrstak/misc/configEditor.hpp | 2 +- xmrstak/misc/environment.hpp | 2 +- xmrstak/misc/executor.hpp | 2 +- xmrstak/misc/telemetry.cpp | 2 +- xmrstak/misc/telemetry.hpp | 2 +- xmrstak/misc/utility.cpp | 2 +- xmrstak/misc/utility.hpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'xmrstak/misc') diff --git a/xmrstak/misc/configEditor.hpp b/xmrstak/misc/configEditor.hpp index a840bc4..8a81ad6 100644 --- a/xmrstak/misc/configEditor.hpp +++ b/xmrstak/misc/configEditor.hpp @@ -54,4 +54,4 @@ struct configEditor }; -} // namepsace xmrstak +} // namespace xmrstak diff --git a/xmrstak/misc/environment.hpp b/xmrstak/misc/environment.hpp index 99c2db8..b67c858 100644 --- a/xmrstak/misc/environment.hpp +++ b/xmrstak/misc/environment.hpp @@ -38,4 +38,4 @@ struct environment params* pParams = nullptr; }; -} // namepsace xmrstak +} // namespace xmrstak diff --git a/xmrstak/misc/executor.hpp b/xmrstak/misc/executor.hpp index fbaa265..3d0d6c9 100644 --- a/xmrstak/misc/executor.hpp +++ b/xmrstak/misc/executor.hpp @@ -23,7 +23,7 @@ namespace cpu class minethd; } // namespace cpu -} // namepsace xmrstak +} // namespace xmrstak class executor { diff --git a/xmrstak/misc/telemetry.cpp b/xmrstak/misc/telemetry.cpp index 738d287..28fb522 100644 --- a/xmrstak/misc/telemetry.cpp +++ b/xmrstak/misc/telemetry.cpp @@ -105,4 +105,4 @@ void telemetry::push_perf_value(size_t iThd, uint64_t iHashCount, uint64_t iTime iBucketTop[iThd] = (iTop + 1) & iBucketMask; } -} // namepsace xmrstak +} // namespace xmrstak diff --git a/xmrstak/misc/telemetry.hpp b/xmrstak/misc/telemetry.hpp index b35bbbf..2f84dfa 100644 --- a/xmrstak/misc/telemetry.hpp +++ b/xmrstak/misc/telemetry.hpp @@ -21,4 +21,4 @@ private: uint64_t** ppTimestamps; }; -} // namepsace xmrstak +} // namespace xmrstak diff --git a/xmrstak/misc/utility.cpp b/xmrstak/misc/utility.cpp index 3b1369a..5177d14 100644 --- a/xmrstak/misc/utility.cpp +++ b/xmrstak/misc/utility.cpp @@ -18,4 +18,4 @@ namespace xmrstak } ); } -} // namepsace xmrstak +} // namespace xmrstak diff --git a/xmrstak/misc/utility.hpp b/xmrstak/misc/utility.hpp index b2e841d..8f2e99f 100644 --- a/xmrstak/misc/utility.hpp +++ b/xmrstak/misc/utility.hpp @@ -9,4 +9,4 @@ namespace xmrstak * @return true if both strings are equal, else false */ bool strcmp_i(const std::string& str1, const std::string& str2); -} // namepsace xmrstak +} // namespace xmrstak -- cgit v1.1 From 5fd4520afa4dd824676f9e24e3f3c771687a6a39 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Thu, 5 Apr 2018 23:30:19 -0600 Subject: Repair more typos in comments only --- xmrstak/misc/executor.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xmrstak/misc') diff --git a/xmrstak/misc/executor.hpp b/xmrstak/misc/executor.hpp index 3d0d6c9..9e145c3 100644 --- a/xmrstak/misc/executor.hpp +++ b/xmrstak/misc/executor.hpp @@ -54,7 +54,7 @@ private: inline void set_timestamp() { dev_timestamp = get_timestamp(); }; - // In miliseconds, has to divide a second (1000ms) into an integer number + // In milliseconds, has to divide a second (1000ms) into an integer number constexpr static size_t iTickTime = 500; // Dev donation time period in seconds. 100 minutes by default. -- cgit v1.1 From 01ebc092d274d5244d2375d049f3baf91750f2a6 Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Sat, 14 Apr 2018 22:09:39 +0200 Subject: fix a few conversion warnings - fix conversion from large type tp small --- xmrstak/misc/console.cpp | 4 ++-- xmrstak/misc/console.hpp | 2 +- xmrstak/misc/executor.hpp | 2 +- xmrstak/misc/telemetry.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'xmrstak/misc') diff --git a/xmrstak/misc/console.cpp b/xmrstak/misc/console.cpp index de5eed3..d961b71 100644 --- a/xmrstak/misc/console.cpp +++ b/xmrstak/misc/console.cpp @@ -225,7 +225,7 @@ void printer::print_str(const char* str) //Do a press any key for the windows folk. *insert any key joke here* #ifdef _WIN32 -void win_exit(size_t code) +void win_exit(int code) { size_t envSize = 0; getenv_s(&envSize, nullptr, 0, "XMRSTAK_NOWAIT"); @@ -238,7 +238,7 @@ void win_exit(size_t code) } #else -void win_exit(size_t code) +void win_exit(int code) { std::exit(code); } diff --git a/xmrstak/misc/console.hpp b/xmrstak/misc/console.hpp index cfbeddd..6717631 100644 --- a/xmrstak/misc/console.hpp +++ b/xmrstak/misc/console.hpp @@ -49,4 +49,4 @@ private: FILE* logfile; }; -void win_exit(size_t code = 1); +void win_exit(int code = 1); diff --git a/xmrstak/misc/executor.hpp b/xmrstak/misc/executor.hpp index 9e145c3..be5ee6c 100644 --- a/xmrstak/misc/executor.hpp +++ b/xmrstak/misc/executor.hpp @@ -64,7 +64,7 @@ private: inline bool is_dev_time() { //Add 2 seconds to compensate for connect - constexpr size_t dev_portion = double(iDevDonatePeriod) * fDevDonationLevel + 2; + constexpr size_t dev_portion = static_cast(double(iDevDonatePeriod) * fDevDonationLevel + 2.); if(dev_portion < 12) //No point in bothering with less than 10s return false; diff --git a/xmrstak/misc/telemetry.cpp b/xmrstak/misc/telemetry.cpp index 28fb522..a3a2a12 100644 --- a/xmrstak/misc/telemetry.cpp +++ b/xmrstak/misc/telemetry.cpp @@ -89,8 +89,8 @@ double telemetry::calc_telemetry_data(size_t iLastMilisec, size_t iThread) return nan(""); double fHashes, fTime; - fHashes = iLastestHashCnt - iEarliestHashCnt; - fTime = iLastestStamp - iEarliestStamp; + fHashes = static_cast(iLastestHashCnt - iEarliestHashCnt); + fTime = static_cast(iLastestStamp - iEarliestStamp); fTime /= 1000.0; return fHashes / fTime; -- cgit v1.1 From 0877e2f654b203c5145bb8154fcfb1ad46ba8265 Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Mon, 16 Apr 2018 21:46:33 +0200 Subject: add independent dev pool coin description - allow the dev pool to fork on a different block version than the user descriped coin All algorithm are centered around the user coin description. It is allowed to have two two different coin algorithms in the user coin description. It is only allowed to use algorithms for the dev pool coin description those are used in the user coin description. There are two ways to define a non forking coin. - set both user coin algorithm descriptions to the same algorithm and set version to zero - set the first algorithm in the user coin description to something you like to use in the dev pool and set the second algorithm to the correct representation of the coin. Set the version to 255. This will allow that the dev pool can mine on a different coin algorithm than the not forking user coin. Do not use an algorithm with different scratchpad size for the dev pool. --- xmrstak/misc/coinDescription.hpp | 60 ++++++++++++++++++++++++++++++++++++++++ xmrstak/misc/executor.cpp | 10 +++++-- 2 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 xmrstak/misc/coinDescription.hpp (limited to 'xmrstak/misc') diff --git a/xmrstak/misc/coinDescription.hpp b/xmrstak/misc/coinDescription.hpp new file mode 100644 index 0000000..c8acf04 --- /dev/null +++ b/xmrstak/misc/coinDescription.hpp @@ -0,0 +1,60 @@ +#pragma once + +#include "xmrstak/backend/cryptonight.hpp" + +#include +#include + + +namespace xmrstak +{ + struct coinDescription + { + xmrstak_algo algo; + xmrstak_algo algo_root; + uint8_t fork_version; + + coinDescription() = default; + + coinDescription(const xmrstak_algo in_algo, xmrstak_algo in_algo_root, const uint8_t in_fork_version) : + algo(in_algo), algo_root(in_algo_root), fork_version(in_fork_version) + {} + + inline xmrstak_algo GetMiningAlgo() const { return algo; } + inline xmrstak_algo GetMiningAlgoRoot() const { return algo_root; } + inline uint8_t GetMiningForkVersion() const { return fork_version; } + }; + + struct coin_selection + { + const char* coin_name = nullptr; + /* [0] -> user pool + * [1] -> dev pool + */ + coinDescription pool_coin[2]; + const char* default_pool = nullptr; + + coin_selection() = default; + + coin_selection( + const char* in_coin_name, + const coinDescription user_coinDescription, + const coinDescription dev_coinDescription, + const char* in_default_pool + ) : + coin_name(in_coin_name), default_pool(in_default_pool) + { + pool_coin[0] = user_coinDescription; + pool_coin[1] = dev_coinDescription; + } + + /** get coin description for the pool + * + * @param poolId 0 select dev pool, else the user pool is selected + */ + inline coinDescription GetDescription(size_t poolId) const { + coinDescription tmp = (poolId == 0 ? pool_coin[1] : pool_coin[0]); + return tmp; + } + }; +} // namespace xmrstak \ No newline at end of file diff --git a/xmrstak/misc/executor.cpp b/xmrstak/misc/executor.cpp index 0e1dd9f..8c454eb 100644 --- a/xmrstak/misc/executor.cpp +++ b/xmrstak/misc/executor.cpp @@ -421,7 +421,9 @@ void executor::on_miner_result(size_t pool_id, job_result& oResult) { //Ignore errors silently if(pool->is_running() && pool->is_logged_in()) - pool->cmd_submit(oResult.sJobID, oResult.iNonce, oResult.bResult, backend_name, backend_hashcount, total_hashcount, jconf::inst()->GetMiningAlgo()); + pool->cmd_submit(oResult.sJobID, oResult.iNonce, oResult.bResult, backend_name, + backend_hashcount, total_hashcount, jconf::inst()->GetCurrentCoinSelection().GetDescription(0).GetMiningAlgo() + ); return; } @@ -432,7 +434,9 @@ void executor::on_miner_result(size_t pool_id, job_result& oResult) } size_t t_start = get_timestamp_ms(); - bool bResult = pool->cmd_submit(oResult.sJobID, oResult.iNonce, oResult.bResult, backend_name, backend_hashcount, total_hashcount, jconf::inst()->GetMiningAlgo()); + bool bResult = pool->cmd_submit(oResult.sJobID, oResult.iNonce, oResult.bResult, + backend_name, backend_hashcount, total_hashcount, jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo() + ); size_t t_len = get_timestamp_ms() - t_start; if(t_len > 0xFFFF) @@ -548,7 +552,7 @@ void executor::ex_main() pools.emplace_back(i+1, params.poolURL.c_str(), params.poolUsername.c_str(), params.poolRigid.c_str(), params.poolPasswd.c_str(), 9.9, false, params.poolUseTls, "", params.nicehashMode); } - switch(jconf::inst()->GetMiningAlgo()) + switch(jconf::inst()->GetCurrentCoinSelection().GetDescription(0).GetMiningAlgo()) { case cryptonight_heavy: if(dev_tls) -- cgit v1.1 From 9fcf6807cc981136e95d8b8a2568e9ce2a6a6c8f Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Tue, 17 Apr 2018 21:18:27 +0200 Subject: add missing EOadd missing EOF --- xmrstak/misc/coinDescription.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xmrstak/misc') diff --git a/xmrstak/misc/coinDescription.hpp b/xmrstak/misc/coinDescription.hpp index c8acf04..73d9a95 100644 --- a/xmrstak/misc/coinDescription.hpp +++ b/xmrstak/misc/coinDescription.hpp @@ -57,4 +57,4 @@ namespace xmrstak return tmp; } }; -} // namespace xmrstak \ No newline at end of file +} // namespace xmrstak -- cgit v1.1