diff options
author | fireice-uk <fireice-uk@users.noreply.github.com> | 2018-03-29 20:50:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-29 20:50:57 +0100 |
commit | ef87d28da53ce40d79e053668dbddab82ef997b0 (patch) | |
tree | 33a06f0238cb643f4618cf9e8024a07649695d5b /xmrstak/backend/amd/minethd.cpp | |
parent | 89d319a8920ee91f0b8c05000bfc7d155b90bcb0 (diff) | |
parent | 0c48570ac662662fc9e808c0efe042f843fd6b23 (diff) | |
download | xmr-stak-ef87d28da53ce40d79e053668dbddab82ef997b0.zip xmr-stak-ef87d28da53ce40d79e053668dbddab82ef997b0.tar.gz |
Merge pull request #1236 from psychocrypt/topic-powAeonv7
POW AEON v7
Diffstat (limited to 'xmrstak/backend/amd/minethd.cpp')
-rw-r--r-- | xmrstak/backend/amd/minethd.cpp | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp index 46a04d5..78774c0 100644 --- a/xmrstak/backend/amd/minethd.cpp +++ b/xmrstak/backend/amd/minethd.cpp @@ -192,14 +192,9 @@ void minethd::work_main() cryptonight_ctx* cpu_ctx; cpu_ctx = cpu::minethd::minethd_alloc_ctx(); auto miner_algo = ::jconf::inst()->GetMiningAlgo(); - cn_hash_fun hash_fun; - if(miner_algo == cryptonight_monero || miner_algo == cryptonight_heavy) - { - // start with cryptonight and switch later if fork version is reached - hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, cryptonight); - } - else - hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo); + + // start with root algorithm and switch later if fork version is reached + cn_hash_fun hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, ::jconf::inst()->GetMiningAlgoRoot()); globalStates::inst().iConsumeCnt++; @@ -219,13 +214,12 @@ void minethd::work_main() consume_work(); uint8_t new_version = oWork.getVersion(); - if(miner_algo == cryptonight_monero && version < 7 && new_version >= 7) - { - hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, cryptonight_monero); - } - else if(miner_algo == cryptonight_heavy && version < 3 && new_version >= 3) + const bool time_to_fork = + ((miner_algo == cryptonight_monero || miner_algo == cryptonight_aeon) && version < 7 && new_version >= 7) || + (miner_algo == cryptonight_heavy && version < 3 && new_version >= 3); + if(time_to_fork) { - hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, cryptonight_heavy); + hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo); } version = new_version; continue; @@ -281,13 +275,12 @@ void minethd::work_main() consume_work(); uint8_t new_version = oWork.getVersion(); - if(miner_algo == cryptonight_monero && version < 7 && new_version >= 7) - { - hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, cryptonight_monero); - } - else if(miner_algo == cryptonight_heavy && version < 3 && new_version >= 3) + const bool time_to_fork = + ((miner_algo == cryptonight_monero || miner_algo == cryptonight_aeon) && version < 7 && new_version >= 7) || + (miner_algo == cryptonight_heavy && version < 3 && new_version >= 3); + if(time_to_fork) { - hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, cryptonight_heavy); + hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo); } version = new_version; } |