Permalink
Browse files

add option to disable verification

1 parent 2141c9d commit 830f945e9ffeaa93348bd0874a7d6bac71678771 @KlausT committed Sep 6, 2015
Showing with 152 additions and 128 deletions.
  1. +11 −6 Algo256/blake256.cu
  2. +5 −5 Algo256/keccak256.cu
  3. +5 −5 JHA/jackpotcoin.cu
  4. +3 −3 bitcoin.cu
  5. +6 −0 ccminer.cpp
  6. +5 −5 cuda_nist5.cu
  7. +11 −5 lyra2/lyra2REv2.cu
  8. +1 −0 miner.h
  9. +5 −5 myriadgroestl.cpp
  10. +19 −15 neoscrypt/neoscrypt.cu
  11. +8 −5 pentablake.cu
  12. +5 −5 quark/quarkcoin.cu
  13. +5 −5 qubit/deep.cu
  14. +3 −3 qubit/doom.cu
  15. +5 −5 qubit/qubit.cu
  16. +1 −1 skein.cu
  17. +11 −12 x11/c11.cu
  18. +5 −5 x11/fresh.cu
  19. +5 −5 x11/s3.cu
  20. +5 −5 x11/x11.cu
  21. +5 −5 x13/x13.cu
  22. +5 −5 x15/whirlpool.cu
  23. +5 −5 x15/whirlpoolx.cu
  24. +5 −5 x15/x14.cu
  25. +5 −5 x15/x15.cu
  26. +3 −3 x17/x17.cu
View
@@ -771,15 +771,17 @@ extern int scanhash_blake256(int thr_id, uint32_t *pdata, uint32_t *ptarget,
if(stop_mining) {mining_has_stopped[thr_id] = true; cudaStreamDestroy(gpustream[thr_id]); pthread_exit(nullptr);}
if(foundNonce != UINT32_MAX)
{
- uint32_t vhashcpu[8];
+ uint32_t vhashcpu[8] = { 0 };
uint32_t Htarg = (uint32_t)targetHigh;
for (int k=0; k < 19; k++)
be32enc(&endiandata[k], pdata[k]);
- be32enc(&endiandata[19], foundNonce);
- blake256hash(vhashcpu, endiandata, blakerounds);
-
+ if(opt_verify)
+ {
+ be32enc(&endiandata[19], foundNonce);
+ blake256hash(vhashcpu, endiandata, blakerounds);
+ }
//applog(LOG_BLUE, "%08x %16llx", vhashcpu[6], targetHigh);
if (vhashcpu[6] <= Htarg && fulltest(vhashcpu, ptarget))
{
@@ -789,8 +791,11 @@ extern int scanhash_blake256(int thr_id, uint32_t *pdata, uint32_t *ptarget,
pdata[19] = foundNonce;
#if NBN > 1
if (extra_results[thr_id][0] != UINT32_MAX) {
- be32enc(&endiandata[19], extra_results[thr_id][0]);
- blake256hash(vhashcpu, endiandata, blakerounds);
+ if(opt_verify)
+ {
+ be32enc(&endiandata[19], extra_results[thr_id][0]);
+ blake256hash(vhashcpu, endiandata, blakerounds);
+ }
if (vhashcpu[6] <= Htarg /* && fulltest(vhashcpu, ptarget) */) {
pdata[21] = extra_results[thr_id][0];
applog(LOG_BLUE, "1:%x 2:%x", foundNonce, extra_results[thr_id][0]);
View
@@ -74,21 +74,21 @@ extern int scanhash_keccak256(int thr_id, uint32_t *pdata,
if(h_nounce[0] != UINT32_MAX)
{
uint32_t Htarg = ptarget[7];
- uint32_t vhash64[8];
- be32enc(&endiandata[19], h_nounce[0]);
+ uint32_t vhash64[8]={0};
+ if(opt_verify){ be32enc(&endiandata[19], h_nounce[0]);
keccak256_hash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
int res = 1;
// check if there was some other ones...
*hashes_done = pdata[19] - first_nonce + throughput;
if (h_nounce[1] != 0xffffffff)
{
- be32enc(&endiandata[19], h_nounce[1]);
+ if(opt_verify){ be32enc(&endiandata[19], h_nounce[1]);
keccak256_hash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
pdata[21] = h_nounce[1];
res++;
View
@@ -199,23 +199,23 @@ extern int scanhash_jackpot(int thr_id, uint32_t *pdata,
if(foundNonce != 0xffffffff)
{
unsigned int rounds;
- uint32_t vhash64[8];
+ uint32_t vhash64[8]={0};
uint32_t Htarg = ptarget[7];
- be32enc(&endiandata[19], foundNonce);
+ if(opt_verify){ be32enc(&endiandata[19], foundNonce);
// diese jackpothash Funktion gibt die Zahl der Runden zurück
rounds = jackpothash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) {
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) {
int res = 1;
uint32_t secNonce = cuda_check_hash_suppl(thr_id, throughput, pdata[19], d_hash, foundNonce);
*hashes_done = pdata[19] - first_nonce + throughput;
if (secNonce != 0)
{
- be32enc(&endiandata[19], secNonce);
+ if(opt_verify){ be32enc(&endiandata[19], secNonce);
rounds = jackpothash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
pdata[21] = secNonce;
res++;
View
@@ -156,17 +156,17 @@ int scanhash_bitcoin(int thr_id, uint32_t *pdata,
if(stop_mining) {mining_has_stopped[thr_id] = true; cudaStreamDestroy(gpustream[thr_id]); pthread_exit(nullptr);}
if(h_nounce[0] != UINT32_MAX)
{
- uint32_t vhash64[8];
+ uint32_t vhash64[8]={0};
bitcoin_hash(vhash64, pdata, h_nounce[0], ms);
- if (vhash64[7] == 0 && fulltest(vhash64, ptarget))
+ if (!opt_verify || (vhash64[7] == 0 && fulltest(vhash64, ptarget)))
{
int res = 1;
// check if there was some other ones...
*hashes_done = pdata[19] - first_nonce + throughput;
if (h_nounce[1] != 0xffffffff)
{
bitcoin_hash(vhash64, pdata, h_nounce[1], ms);
- if (vhash64[7] == 0 && fulltest(vhash64, ptarget))
+ if (!opt_verify || (vhash64[7] == 0 && fulltest(vhash64, ptarget)))
{
pdata[21] = h_nounce[1];
res++;
View
@@ -153,6 +153,7 @@ static const char *algo_names[] = {
"neoscrypt"
};
+bool opt_verify = true;
bool opt_debug = false;
bool opt_protocol = false;
bool opt_benchmark = false;
@@ -311,6 +312,7 @@ Options:\n\
-B, --background run the miner in the background\n\
--benchmark run in offline benchmark mode\n\
--cputest debug hashes from cpu algorithms\n\
+ --no-cpu-verify don't verify the found results\n\
-c, --config=FILE load a JSON-format configuration file\n\
-V, --version display version information and exit\n\
-h, --help display this help text and exit\n\
@@ -334,6 +336,7 @@ static struct option const options[] =
#endif
{ "benchmark", 0, NULL, 1005 },
{ "cert", 1, NULL, 1001 },
+ { "no-cpu-verify", 0, NULL, 1022 },
{ "config", 1, NULL, 'c' },
{ "cputest", 0, NULL, 1006 },
{ "cpu-affinity", 1, NULL, 1020 },
@@ -2357,6 +2360,9 @@ static void parse_arg(int key, char *arg)
show_usage_and_exit(1);
opt_priority = v;
break;
+ case 1022:
+ opt_verify = false;
+ break;
case 'd': // CB
{
int ngpus = cuda_num_devices();
View
@@ -119,19 +119,19 @@ extern int scanhash_nist5(int thr_id, uint32_t *pdata,
if(h_found[0] != 0xffffffff)
{
const uint32_t Htarg = ptarget[7];
- uint32_t vhash64[8];
- be32enc(&endiandata[19], h_found[0]);
+ uint32_t vhash64[8]={0};
+ if(opt_verify){ be32enc(&endiandata[19], h_found[0]);
nist5hash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
int res = 1;
*hashes_done = pdata[19] - first_nonce + throughput;
if (h_found[1] != 0xffffffff)
{
- be32enc(&endiandata[19], h_found[1]);
+ if(opt_verify){ be32enc(&endiandata[19], h_found[1]);
nist5hash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
pdata[21] = h_found[1];
View
@@ -150,18 +150,24 @@ int scanhash_lyra2v2(int thr_id, uint32_t *pdata,
if(foundNonce[0] != 0)
{
const uint32_t Htarg = ptarget[7];
- uint32_t vhash64[8];
- be32enc(&endiandata[19], foundNonce[0]);
- lyra2v2_hash(vhash64, endiandata);
+ uint32_t vhash64[8]={0};
+ if(opt_verify)
+ {
+ be32enc(&endiandata[19], foundNonce[0]);
+ lyra2v2_hash(vhash64, endiandata);
+ }
if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
int res = 1;
// check if there was some other ones...
*hashes_done = pdata[19] - first_nonce + throughput;
if (foundNonce[1] != 0)
{
- be32enc(&endiandata[19], foundNonce[1]);
- lyra2v2_hash(vhash64, endiandata);
+ if(opt_verify)
+ {
+ be32enc(&endiandata[19], foundNonce[1]);
+ lyra2v2_hash(vhash64, endiandata);
+ }
if(vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
pdata[21] = foundNonce[1];
View
@@ -481,6 +481,7 @@ struct thr_info {
struct cgpu_info gpu;
};
+extern bool opt_verify;
extern bool opt_benchmark;
extern bool opt_debug;
extern bool opt_quiet;
View
@@ -79,19 +79,19 @@ extern int scanhash_myriad(int thr_id, uint32_t *pdata, uint32_t *ptarget,
if(h_found[0] != 0xffffffff)
{
const uint32_t Htarg = ptarget[7];
- uint32_t vhash64[8];
- be32enc(&endiandata[19], h_found[0]);
+ uint32_t vhash64[8]={0};
+ if(opt_verify){ be32enc(&endiandata[19], h_found[0]);
myriadhash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
int res = 1;
*hashes_done = pdata[19] - start_nonce + throughput;
if (h_found[1] != 0xffffffff)
{
- be32enc(&endiandata[19], h_found[1]);
+ if(opt_verify){ be32enc(&endiandata[19], h_found[1]);
myriadhash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
pdata[21] = h_found[1];
@@ -81,30 +81,34 @@ int scanhash_neoscrypt(bool stratum, int thr_id, uint32_t *pdata,
}
if(foundNonce[0] != 0xffffffff)
{
- uint32_t vhash64[8];
-
- if(stratum)
- be32enc(&endiandata[19], foundNonce[0]);
- else
- endiandata[19] = foundNonce[0];
- neoscrypt((unsigned char*)endiandata, (unsigned char*)vhash64, 0x80000620);
-
+ uint32_t vhash64[8]={0};
+ if(opt_verify)
+ {
+ if(stratum)
+ be32enc(&endiandata[19], foundNonce[0]);
+ else
+ endiandata[19] = foundNonce[0];
+ neoscrypt((unsigned char*)endiandata, (unsigned char*)vhash64, 0x80000620);
+ }
if(vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget))
{
*hashes_done = pdata[19] - first_nonce + throughput;
int res = 1;
if(opt_benchmark) applog(LOG_INFO, "GPU #%d Found nounce %08x", thr_id, foundNonce[0]);
if(foundNonce[1] != 0xffffffff)
{
- if(stratum)
- {
- be32enc(&endiandata[19], foundNonce[1]);
- }
- else
+ if(opt_verify)
{
- endiandata[19] = foundNonce[1];
+ if(stratum)
+ {
+ be32enc(&endiandata[19], foundNonce[1]);
+ }
+ else
+ {
+ endiandata[19] = foundNonce[1];
+ }
+ neoscrypt((unsigned char*)endiandata, (unsigned char*)vhash64, 0x80000620);
}
- neoscrypt((unsigned char*)endiandata, (unsigned char*)vhash64, 0x80000620);
if(vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget))
{
pdata[21] = foundNonce[1];
View
@@ -484,12 +484,15 @@ extern int scanhash_pentablake(int thr_id, uint32_t *pdata, uint32_t *ptarget,
if(foundNonce != UINT32_MAX)
{
const uint32_t Htarg = ptarget[7];
- uint32_t vhashcpu[8];
+ uint32_t vhashcpu[8] = { 0 };
- be32enc(&endiandata[19], foundNonce);
- pentablakehash(vhashcpu, endiandata);
-
- if (vhashcpu[7] <= Htarg && fulltest(vhashcpu, ptarget)) {
+ if(opt_verify)
+ {
+ be32enc(&endiandata[19], foundNonce);
+ pentablakehash(vhashcpu, endiandata);
+ }
+ if (vhashcpu[7] <= Htarg && fulltest(vhashcpu, ptarget))
+ {
rc = 1;
*hashes_done = pdata[19] - first_nonce + throughput;
if (extra_results[thr_id][0] != UINT32_MAX) {
View
@@ -241,22 +241,22 @@ extern int scanhash_quark(int thr_id, uint32_t *pdata,
if (foundnonces[0] != 0xffffffff)
{
const uint32_t Htarg = ptarget[7];
- uint32_t vhash64[8];
- be32enc(&endiandata[19], foundnonces[0]);
+ uint32_t vhash64[8]={0};
+ if(opt_verify){ be32enc(&endiandata[19], foundnonces[0]);
quarkhash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
int res = 1;
*hashes_done = pdata[19] - first_nonce + throughput;
if(opt_benchmark) applog(LOG_INFO, "GPU #%d: Found nonce $%08X", device_map[thr_id], foundnonces[0]);
// check if there was some other ones...
if (foundnonces[1] != 0xffffffff)
{
- be32enc(&endiandata[19], foundnonces[1]);
+ if(opt_verify){ be32enc(&endiandata[19], foundnonces[1]);
quarkhash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
pdata[21] = foundnonces[1];
res++;
View
@@ -100,19 +100,19 @@ extern int scanhash_deep(int thr_id, uint32_t *pdata,
if(h_found[0] != 0xffffffff)
{
const uint32_t Htarg = ptarget[7];
- uint32_t vhash64[8];
- be32enc(&endiandata[19], h_found[0]);
+ uint32_t vhash64[8]={0};
+ if(opt_verify){ be32enc(&endiandata[19], h_found[0]);
deephash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
int res = 1;
*hashes_done = pdata[19] - first_nonce + throughput;
if (h_found[1] != 0xffffffff)
{
- be32enc(&endiandata[19], h_found[1]);
+ if(opt_verify){ be32enc(&endiandata[19], h_found[1]);
deephash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
pdata[21] = h_found[1];
View
@@ -71,11 +71,11 @@ extern int scanhash_doom(int thr_id, uint32_t *pdata,
if(foundNonce != UINT32_MAX)
{
const uint32_t Htarg = ptarget[7];
- uint32_t vhash64[8];
- be32enc(&endiandata[19], foundNonce);
+ uint32_t vhash64[8]={0};
+ if(opt_verify){ be32enc(&endiandata[19], foundNonce);
doomhash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) {
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) {
*hashes_done = min(max_nonce - first_nonce, (uint64_t) pdata[19] - first_nonce + throughput);
pdata[19] = foundNonce;
return 1;
View
@@ -145,19 +145,19 @@ extern int scanhash_qubit(int thr_id, uint32_t *pdata,
if(h_found[0] != 0xffffffff)
{
const uint32_t Htarg = ptarget[7];
- uint32_t vhash64[8];
- be32enc(&endiandata[19], h_found[0]);
+ uint32_t vhash64[8]={0};
+ if(opt_verify){ be32enc(&endiandata[19], h_found[0]);
qubithash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
int res = 1;
*hashes_done = pdata[19] - first_nonce + throughput;
if (h_found[1] != 0xffffffff)
{
- be32enc(&endiandata[19], h_found[1]);
+ if(opt_verify){ be32enc(&endiandata[19], h_found[1]);
qubithash(vhash64, endiandata);
- if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
+ } if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget))
{
pdata[21] = h_found[1];
Oops, something went wrong.

0 comments on commit 830f945

Please sign in to comment.