summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/amd/minethd.cpp
diff options
context:
space:
mode:
authorfireice-uk <fireice-uk@users.noreply.github.com>2018-04-02 21:14:14 +0100
committerGitHub <noreply@github.com>2018-04-02 21:14:14 +0100
commit6feffe2228282814abe716d241292ca2648a4e2a (patch)
tree277cc583c0f5df77e781dec0ba5019daf08e75d0 /xmrstak/backend/amd/minethd.cpp
parenta036cd81592e3b3de804ba88bb8f94729ab60b7d (diff)
parent6880be70a6b29a1c850f4a4603bbc38d0ca6d117 (diff)
downloadxmr-stak-6feffe2228282814abe716d241292ca2648a4e2a.zip
xmr-stak-6feffe2228282814abe716d241292ca2648a4e2a.tar.gz
Merge pull request #1279 from fireice-uk/dev
release 2.4.0
Diffstat (limited to 'xmrstak/backend/amd/minethd.cpp')
-rw-r--r--xmrstak/backend/amd/minethd.cpp42
1 files changed, 14 insertions, 28 deletions
diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp
index 46a04d5..cab5ad9 100644
--- a/xmrstak/backend/amd/minethd.cpp
+++ b/xmrstak/backend/amd/minethd.cpp
@@ -191,15 +191,10 @@ void minethd::work_main()
uint64_t iCount = 0;
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
+ auto miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
+ cn_hash_fun hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
globalStates::inst().iConsumeCnt++;
@@ -218,17 +213,18 @@ void minethd::work_main()
std::this_thread::sleep_for(std::chrono::milliseconds(100));
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)
+ continue;
+ }
+
+ uint8_t new_version = oWork.getVersion();
+ if(new_version != version)
+ {
+ if(new_version >= ::jconf::inst()->GetMiningForkVersion())
{
- hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, cryptonight_heavy);
+ miner_algo = ::jconf::inst()->GetMiningAlgo();
+ hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
}
version = new_version;
- continue;
}
uint32_t h_per_round = pGpuCtx->rawIntensity;
@@ -236,7 +232,7 @@ void minethd::work_main()
assert(sizeof(job_result::sJobID) == sizeof(pool_job::sJobID));
uint64_t target = oWork.iTarget;
- /// \todo add monero hard for version
+
XMRSetJob(pGpuCtx, oWork.bWorkBlob, oWork.iWorkSize, target, miner_algo, version);
if(oWork.bNiceHash)
@@ -280,16 +276,6 @@ 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)
- {
- hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, cryptonight_heavy);
- }
- version = new_version;
}
}
OpenPOWER on IntegriCloud