From f2f2f8a77a113834a6fe4ffbac28a1415d60e6ae Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Thu, 3 May 2018 22:44:47 +0200 Subject: set correct `iPoolId` for miner_work - initialize miner_work iPoolId in the default constructor with the invalid pool id - move definition of `pool_data` into an own file --- xmrstak/backend/globalStates.hpp | 15 ++------------- xmrstak/backend/miner_work.hpp | 4 +++- xmrstak/backend/pool_data.hpp | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 xmrstak/backend/pool_data.hpp diff --git a/xmrstak/backend/globalStates.hpp b/xmrstak/backend/globalStates.hpp index fafd232..e1b554f 100644 --- a/xmrstak/backend/globalStates.hpp +++ b/xmrstak/backend/globalStates.hpp @@ -1,26 +1,15 @@ #pragma once -#include "miner_work.hpp" +#include "xmrstak/backend/miner_work.hpp" #include "xmrstak/misc/environment.hpp" #include "xmrstak/misc/console.hpp" +#include "xmrstak/backend/pool_data.hpp" #include -constexpr static size_t invalid_pool_id = (-1); - namespace xmrstak { -struct pool_data -{ - uint32_t iSavedNonce; - size_t pool_id; - - pool_data() : iSavedNonce(0), pool_id(invalid_pool_id) - { - } -}; - struct globalStates { static inline globalStates& inst() diff --git a/xmrstak/backend/miner_work.hpp b/xmrstak/backend/miner_work.hpp index 438ec0d..b6456f0 100644 --- a/xmrstak/backend/miner_work.hpp +++ b/xmrstak/backend/miner_work.hpp @@ -1,5 +1,7 @@ #pragma once +#include "xmrstak/backend/pool_data.hpp" + #include #include #include @@ -20,7 +22,7 @@ namespace xmrstak bool bStall; size_t iPoolId; - miner_work() : iWorkSize(0), bNiceHash(false), bStall(true), iPoolId(0) { } + miner_work() : iWorkSize(0), bNiceHash(false), bStall(true), iPoolId(invalid_pool_id) { } miner_work(const char* sJobID, const uint8_t* bWork, uint32_t iWorkSize, uint64_t iTarget, bool bNiceHash, size_t iPoolId) : iWorkSize(iWorkSize), diff --git a/xmrstak/backend/pool_data.hpp b/xmrstak/backend/pool_data.hpp new file mode 100644 index 0000000..4e92359 --- /dev/null +++ b/xmrstak/backend/pool_data.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +constexpr static size_t invalid_pool_id = (-1); + +namespace xmrstak +{ + +struct pool_data +{ + uint32_t iSavedNonce; + size_t pool_id; + + pool_data() : iSavedNonce(0), pool_id(invalid_pool_id) + { + } +}; + +} // namespace xmrstak -- cgit v1.1