summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpsychocrypt <psychocryptHPC@gmail.com>2018-04-16 17:52:42 +0200
committerpsychocrypt <psychocryptHPC@gmail.com>2018-04-17 21:01:23 +0200
commita5ddd040a6eeb0609e1d1b0f16c1d271d31c7377 (patch)
tree92aad2fd9010eeb278eb1e97a43ec97f6c64b164
parent9df1d4d608f59e81e1e7db1f9b20dd2807e7dd6e (diff)
downloadxmr-stak-a5ddd040a6eeb0609e1d1b0f16c1d271d31c7377.zip
xmr-stak-a5ddd040a6eeb0609e1d1b0f16c1d271d31c7377.tar.gz
fix wrong algo selection
In the case where the dev pool mines on a higher version than a monero fork coin the miner is not resetting the algorithm. This PR select the correct algorithm each time the block version hash changed.
-rw-r--r--xmrstak/backend/amd/minethd.cpp11
-rw-r--r--xmrstak/backend/cpu/minethd.cpp22
-rw-r--r--xmrstak/backend/nvidia/minethd.cpp11
3 files changed, 36 insertions, 8 deletions
diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp
index 9bc3676..a3acf9d 100644
--- a/xmrstak/backend/amd/minethd.cpp
+++ b/xmrstak/backend/amd/minethd.cpp
@@ -201,6 +201,7 @@ void minethd::work_main()
globalStates::inst().iConsumeCnt++;
uint8_t version = 0;
+ size_t lastPoolId = 0;
while (bQuit == 0)
{
@@ -219,13 +220,19 @@ void minethd::work_main()
}
uint8_t new_version = oWork.getVersion();
- if(new_version != version)
+ if(new_version != version || oWork.iPoolId != lastPoolId)
{
- if(new_version >= ::jconf::inst()->GetMiningForkVersion())
+ if(new_version >= ::jconf::inst()->GetMiningForkVersion() || oWork.iPoolId == 0)
{
miner_algo = ::jconf::inst()->GetMiningAlgo();
hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
}
+ else
+ {
+ miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
+ hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
+ }
+ lastPoolId = oWork.iPoolId;
version = new_version;
}
diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp
index 263c83a..9494a79 100644
--- a/xmrstak/backend/cpu/minethd.cpp
+++ b/xmrstak/backend/cpu/minethd.cpp
@@ -434,6 +434,7 @@ void minethd::work_main()
result.iThreadId = iThreadNo;
uint8_t version = 0;
+ size_t lastPoolId = 0;
while (bQuit == 0)
{
@@ -461,13 +462,19 @@ void minethd::work_main()
result.iNonce = *piNonce;
uint8_t new_version = oWork.getVersion();
- if(new_version != version)
+ if(new_version != version || oWork.iPoolId != lastPoolId)
{
- if(new_version >= ::jconf::inst()->GetMiningForkVersion())
+ if(new_version >= ::jconf::inst()->GetMiningForkVersion() || oWork.iPoolId == 0)
{
miner_algo = ::jconf::inst()->GetMiningAlgo();
hash_fun = func_selector(::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
}
+ else
+ {
+ miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
+ hash_fun = func_selector(::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
+ }
+ lastPoolId = oWork.iPoolId;
version = new_version;
}
@@ -692,6 +699,7 @@ void minethd::multiway_work_main()
auto miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
cn_hash_fun_multi hash_fun_multi = func_multi_selector(N, ::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
uint8_t version = 0;
+ size_t lastPoolId = 0;
while (bQuit == 0)
{
@@ -718,13 +726,19 @@ void minethd::multiway_work_main()
iNonce = *piNonce[0];
uint8_t new_version = oWork.getVersion();
- if(new_version != version)
+ if(new_version != version || oWork.iPoolId != lastPoolId)
{
- if(new_version >= ::jconf::inst()->GetMiningForkVersion())
+ if(new_version >= ::jconf::inst()->GetMiningForkVersion() || oWork.iPoolId == 0)
{
miner_algo = ::jconf::inst()->GetMiningAlgo();
hash_fun_multi = func_multi_selector(N, ::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
}
+ else
+ {
+ miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
+ hash_fun_multi = func_multi_selector(N, ::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
+ }
+ lastPoolId = oWork.iPoolId;
version = new_version;
}
diff --git a/xmrstak/backend/nvidia/minethd.cpp b/xmrstak/backend/nvidia/minethd.cpp
index 804c06a..4593dab 100644
--- a/xmrstak/backend/nvidia/minethd.cpp
+++ b/xmrstak/backend/nvidia/minethd.cpp
@@ -247,6 +247,7 @@ void minethd::work_main()
globalStates::inst().iConsumeCnt++;
uint8_t version = 0;
+ size_t lastPoolId = 0;
while (bQuit == 0)
{
@@ -264,13 +265,19 @@ void minethd::work_main()
continue;
}
uint8_t new_version = oWork.getVersion();
- if(new_version != version)
+ if(new_version != version || oWork.iPoolId != lastPoolId)
{
- if(new_version >= ::jconf::inst()->GetMiningForkVersion())
+ if(new_version >= ::jconf::inst()->GetMiningForkVersion() || oWork.iPoolId == 0)
{
miner_algo = ::jconf::inst()->GetMiningAlgo();
hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
}
+ else
+ {
+ miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
+ hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
+ }
+ lastPoolId = oWork.iPoolId;
version = new_version;
}
OpenPOWER on IntegriCloud