diff options
author | psychocrypt <psychocryptHPC@gmail.com> | 2018-04-16 17:52:42 +0200 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2018-06-04 21:07:11 +0000 |
commit | fc8b4543603393bdc006479a687a744e51a859ac (patch) | |
tree | 67d2262d5ab525bea1ff47f84ef883b82c1fb6ae /xmrstak/backend | |
parent | ee5d2c522f5dc9e5564433c05da2f3cc2a9e0ff4 (diff) | |
download | xmr-stak-fc8b4543603393bdc006479a687a744e51a859ac.zip xmr-stak-fc8b4543603393bdc006479a687a744e51a859ac.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.
Diffstat (limited to 'xmrstak/backend')
-rw-r--r-- | xmrstak/backend/amd/minethd.cpp | 11 | ||||
-rw-r--r-- | xmrstak/backend/cpu/minethd.cpp | 22 | ||||
-rw-r--r-- | xmrstak/backend/nvidia/minethd.cpp | 11 |
3 files changed, 36 insertions, 8 deletions
diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp index b1cc1f6..f5de2fe 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 923fec3..e2bb979 100644 --- a/xmrstak/backend/cpu/minethd.cpp +++ b/xmrstak/backend/cpu/minethd.cpp @@ -430,6 +430,7 @@ void minethd::work_main() result.iThreadId = iThreadNo; uint8_t version = 0; + size_t lastPoolId = 0; while (bQuit == 0) { @@ -457,13 +458,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; } @@ -688,6 +695,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) { @@ -714,13 +722,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 514d0f6..b9c1d24 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; } |