diff --git a/Makefile.am b/Makefile.am index b98757b..e6cfd77 100644 --- a/Makefile.am +++ b/Makefile.am @@ -106,7 +106,7 @@ cpuminer_SOURCES = \ algo/lyra2/lyra2rev2.c \ algo/lyra2/lyra2re.c \ algo/lyra2/zcoin.c \ - algo/lyra2/zoin.c \ + algo/lyra2/lyra2z330.c \ algo/keccak/sse2/keccak.c \ algo/m7m.c \ algo/neoscrypt.c \ diff --git a/RELEASE_NOTES b/RELEASE_NOTES index b424f3f..a7c8d89 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -3,6 +3,10 @@ Compile instruction for Linux and Windows are at the bottom of this file. Change Log ---------- +v3.6.0 + +Preliminary support for solo mining using getwork. + v3.5.13 Found more speed in Cubehash, algo improvement depends on chain length, diff --git a/algo-gate-api.c b/algo-gate-api.c index 109d68b..8a2c946 100644 --- a/algo-gate-api.c +++ b/algo-gate-api.c @@ -98,17 +98,12 @@ void null_hash_suw() { applog(LOG_WARNING,"SWERR: null_hash_suw unsafe null function"); }; -void null_hash_alt() -{ - applog(LOG_WARNING,"SWERR: null_hash_alt unsafe null function"); -}; void init_algo_gate( algo_gate_t* gate ) { gate->miner_thread_init = (void*)&return_true; gate->scanhash = (void*)&null_scanhash; gate->hash = (void*)&null_hash; - gate->hash_alt = (void*)&null_hash_alt; gate->hash_suw = (void*)&null_hash_suw; gate->get_new_work = (void*)&std_get_new_work; gate->get_nonceptr = (void*)&std_get_nonceptr; @@ -244,6 +239,7 @@ bool register_json_rpc2( algo_gate_t *gate ) gate->nonce_index = JR2_NONCE_INDEX; jsonrpc_2 = true; // still needed opt_extranonce = false; + have_gbt = false; return true; } @@ -262,7 +258,7 @@ void exec_hash_function( int algo, void *output, const void *pdata ) #define ALIAS (0) // The only difference between the alias and the proper algo name is the -// proper name s the one that is defined in ALGO_NAMES, there may be +// proper name is the one that is defined in ALGO_NAMES, there may be // multiple aliases that map to the same proper name. // New aliases can be added anywhere in the array as long as NULL is last. // Alphabetic order of alias is recommended. diff --git a/algo-gate-api.h b/algo-gate-api.h index 26bdd75..30cd1cb 100644 --- a/algo-gate-api.h +++ b/algo-gate-api.h @@ -110,7 +110,6 @@ int ( *scanhash ) ( int, struct work*, uint32_t, uint64_t* ); // optional unsafe, must be overwritten if algo uses function void ( *hash ) ( void*, const void*, uint32_t ) ; -void ( *hash_alt ) ( void*, const void*, uint32_t ); void ( *hash_suw ) ( void*, const void* ); //optional, safe to use default in most cases @@ -184,7 +183,6 @@ int null_scanhash(); // displays warning void null_hash (); -void null_hash_alt(); void null_hash_suw(); // optional safe targets, default listed first unless noted. diff --git a/algo/axiom.c b/algo/axiom.c index 00f8d94..bbf517f 100644 --- a/algo/axiom.c +++ b/algo/axiom.c @@ -82,7 +82,6 @@ bool register_axiom_algo( algo_gate_t* gate ) { gate->scanhash = (void*)&scanhash_axiom; gate->hash = (void*)&axiomhash; - gate->hash_alt = (void*)&axiomhash; gate->get_max64 = (void*)&get_max64_0x40LL; return true; } diff --git a/algo/blake/blake.c b/algo/blake/blake.c index 4497b18..23061b2 100644 --- a/algo/blake/blake.c +++ b/algo/blake/blake.c @@ -100,7 +100,6 @@ bool register_blake_algo( algo_gate_t* gate ) { gate->scanhash = (void*)&scanhash_blake; gate->hash = (void*)&blakehash; - gate->hash_alt = (void*)&blakehash; gate->get_max64 = (void*)&blake_get_max64; return true; } diff --git a/algo/blake/blakecoin.c b/algo/blake/blakecoin.c index 9d8ea26..703bb01 100644 --- a/algo/blake/blakecoin.c +++ b/algo/blake/blakecoin.c @@ -109,7 +109,6 @@ bool register_vanilla_algo( algo_gate_t* gate ) { gate->scanhash = (void*)&scanhash_blakecoin; gate->hash = (void*)&blakecoinhash; - gate->hash_alt = (void*)&blakecoinhash; gate->get_max64 = (void*)&blakecoin_get_max64; blakecoin_init( &blake_init_ctx ); return true; diff --git a/algo/blake/decred.c b/algo/blake/decred.c index 3ebf3b3..8599109 100644 --- a/algo/blake/decred.c +++ b/algo/blake/decred.c @@ -270,7 +270,6 @@ bool register_decred_algo( algo_gate_t* gate ) gate->optimizations = SSE2_OPT; gate->scanhash = (void*)&scanhash_decred; gate->hash = (void*)&decred_hash; - gate->hash_alt = (void*)&decred_hash; gate->get_nonceptr = (void*)&decred_get_nonceptr; gate->get_max64 = (void*)&get_max64_0x3fffffLL; gate->display_extra_data = (void*)&decred_decode_extradata; diff --git a/algo/drop.c b/algo/drop.c index aa3dae3..a75892b 100644 --- a/algo/drop.c +++ b/algo/drop.c @@ -245,8 +245,6 @@ bool register_drop_algo( algo_gate_t* gate ) algo_not_tested(); gate->scanhash = (void*)&scanhash_drop; gate->hash = (void*)&droplp_hash_pok; - gate->hash_alt = (void*)&droplp_hash_pok; - gate->hash_suw = (void*)&droplp_hash_pok; gate->get_new_work = (void*)&drop_get_new_work; gate->set_target = (void*)&scrypt_set_target; gate->build_stratum_request = (void*)&std_be_build_stratum_request; diff --git a/algo/fresh.c b/algo/fresh.c index a0a71a9..bded11c 100644 --- a/algo/fresh.c +++ b/algo/fresh.c @@ -131,7 +131,6 @@ bool register_fresh_algo( algo_gate_t* gate ) algo_not_tested(); gate->scanhash = (void*)&scanhash_fresh; gate->hash = (void*)&freshhash; - gate->hash_alt = (void*)&freshhash; gate->set_target = (void*)&fresh_set_target; gate->get_max64 = (void*)&get_max64_0x3ffff; return true; diff --git a/algo/groestl/groestl.c b/algo/groestl/groestl.c index 6297c84..ec62df9 100644 --- a/algo/groestl/groestl.c +++ b/algo/groestl/groestl.c @@ -104,7 +104,6 @@ bool register_groestl_algo( algo_gate_t* gate ) gate->optimizations = SSE2_OPT | AES_OPT; gate->scanhash = (void*)&scanhash_groestl; gate->hash = (void*)&groestlhash; - gate->hash_alt = (void*)&groestlhash; gate->set_target = (void*)&groestl_set_target; gate->gen_merkle_root = (void*)&SHA256_gen_merkle_root; gate->get_max64 = (void*)&get_max64_0x3ffff; diff --git a/algo/groestl/myr-groestl.c b/algo/groestl/myr-groestl.c index 53fbfdd..61265c2 100644 --- a/algo/groestl/myr-groestl.c +++ b/algo/groestl/myr-groestl.c @@ -96,7 +96,6 @@ bool register_myriad_algo( algo_gate_t* gate ) init_myrgr_ctx(); gate->scanhash = (void*)&scanhash_myriad; gate->hash = (void*)&myriadhash; - gate->hash_alt = (void*)&myriadhash; gate->get_max64 = (void*)&get_max64_0x3ffff; return true; }; diff --git a/algo/heavy/bastion.c b/algo/heavy/bastion.c index e4ff906..22ae237 100644 --- a/algo/heavy/bastion.c +++ b/algo/heavy/bastion.c @@ -171,7 +171,6 @@ bool register_bastion_algo( algo_gate_t* gate ) gate->optimizations = SSE2_OPT | AES_OPT; gate->scanhash = (void*)&scanhash_bastion; gate->hash = (void*)&bastionhash; - gate->hash_alt = (void*)&bastionhash; return true; }; diff --git a/algo/hmq1725.c b/algo/hmq1725.c index b2877bd..88084c7 100644 --- a/algo/hmq1725.c +++ b/algo/hmq1725.c @@ -420,7 +420,6 @@ bool register_hmq1725_algo( algo_gate_t* gate ) gate->set_target = (void*)&scrypt_set_target; gate->scanhash = (void*)&scanhash_hmq1725; gate->hash = (void*)&hmq1725hash; - gate->hash_alt = (void*)&hmq1725hash; return true; }; diff --git a/algo/lbry.c b/algo/lbry.c index 7d957bb..60408d1 100644 --- a/algo/lbry.c +++ b/algo/lbry.c @@ -213,7 +213,6 @@ bool register_lbry_algo( algo_gate_t* gate ) { gate->scanhash = (void*)&scanhash_lbry; gate->hash = (void*)&lbry_hash; - gate->hash_alt = (void*)&lbry_hash; gate->calc_network_diff = (void*)&lbry_calc_network_diff; gate->get_max64 = (void*)&lbry_get_max64; gate->build_stratum_request = (void*)&lbry_le_build_stratum_request; diff --git a/algo/lyra2/lyra2re.c b/algo/lyra2/lyra2re.c index 49cad58..bcd94a1 100644 --- a/algo/lyra2/lyra2re.c +++ b/algo/lyra2/lyra2re.c @@ -159,7 +159,6 @@ bool register_lyra2re_algo( algo_gate_t* gate ) // gate->miner_thread_init = (void*)&lyra2re_thread_init; gate->scanhash = (void*)&scanhash_lyra2re; gate->hash = (void*)&lyra2re_hash; - gate->hash_alt = (void*)&lyra2re_hash; gate->get_max64 = (void*)&lyra2re_get_max64; gate->set_target = (void*)&lyra2re_set_target; return true; diff --git a/algo/lyra2/lyra2rev2.c b/algo/lyra2/lyra2rev2.c index 17e0ec5..f96214b 100644 --- a/algo/lyra2/lyra2rev2.c +++ b/algo/lyra2/lyra2rev2.c @@ -153,7 +153,6 @@ bool register_lyra2rev2_algo( algo_gate_t* gate ) gate->miner_thread_init = (void*)&lyra2rev2_thread_init; gate->scanhash = (void*)&scanhash_lyra2rev2; gate->hash = (void*)&lyra2rev2_hash; - gate->hash_alt = (void*)&lyra2rev2_hash; gate->set_target = (void*)&lyra2rev2_set_target; return true; }; diff --git a/algo/lyra2/zoin.c b/algo/lyra2/lyra2z330.c similarity index 60% rename from algo/lyra2/zoin.c rename to algo/lyra2/lyra2z330.c index 1c80ca3..f3ce946 100644 --- a/algo/lyra2/zoin.c +++ b/algo/lyra2/lyra2z330.c @@ -4,19 +4,20 @@ #include "lyra2.h" #include "avxdefs.h" -__thread uint64_t* zoin_wholeMatrix; +__thread uint64_t* lyra2z330_wholeMatrix; -void zoin_hash(void *state, const void *input, uint32_t height) +void lyra2z330_hash(void *state, const void *input, uint32_t height) { uint32_t _ALIGN(256) hash[16]; - LYRA2Z( zoin_wholeMatrix, hash, 32, input, 80, input, 80, 2, 330, 256); + LYRA2Z( lyra2z330_wholeMatrix, hash, 32, input, 80, input, 80, + 2, 330, 256 ); memcpy(state, hash, 32); } -int scanhash_zoin( int thr_id, struct work *work, uint32_t max_nonce, - uint64_t *hashes_done ) +int scanhash_lyra2z330( int thr_id, struct work *work, uint32_t max_nonce, + uint64_t *hashes_done ) { uint32_t hash[8] __attribute__ ((aligned (64))); uint32_t endiandata[20] __attribute__ ((aligned (64))); @@ -34,7 +35,7 @@ int scanhash_zoin( int thr_id, struct work *work, uint32_t max_nonce, do { be32enc(&endiandata[19], nonce); - zoin_hash( hash, endiandata, work->height ); + lyra2z330_hash( hash, endiandata, work->height ); if (hash[7] <= Htarg && fulltest(hash, ptarget)) { work_set_target_ratio(work, hash); @@ -51,28 +52,28 @@ int scanhash_zoin( int thr_id, struct work *work, uint32_t max_nonce, return 0; } -void zoin_set_target( struct work* work, double job_diff ) +void lyra2z330_set_target( struct work* work, double job_diff ) { work_set_target( work, job_diff / (256.0 * opt_diff_factor) ); } -bool zoin_thread_init() +bool lyra2z330_thread_init() { const int64_t ROW_LEN_INT64 = BLOCK_LEN_INT64 * 256; // nCols const int64_t ROW_LEN_BYTES = ROW_LEN_INT64 * 8; int i = (int64_t)ROW_LEN_BYTES * 330; // nRows; - zoin_wholeMatrix = _mm_malloc( i, 64 ); + lyra2z330_wholeMatrix = _mm_malloc( i, 64 ); - if ( zoin_wholeMatrix == NULL ) + if ( lyra2z330_wholeMatrix == NULL ) return false; #if defined (__AVX2__) - memset_zero_m256i( (__m256i*)zoin_wholeMatrix, i/32 ); + memset_zero_m256i( (__m256i*)lyra2z330_wholeMatrix, i/32 ); #elif defined(__AVX__) - memset_zero_m128i( (__m128i*)zoin_wholeMatrix, i/16 ); + memset_zero_m128i( (__m128i*)lyra2z330_wholeMatrix, i/16 ); #else - memset( zoin_wholeMatrix, 0, i ); + memset( lyra2z330_wholeMatrix, 0, i ); #endif return true; } @@ -80,12 +81,11 @@ bool zoin_thread_init() bool register_lyra2z330_algo( algo_gate_t* gate ) { gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | AVX2_OPT; - gate->miner_thread_init = (void*)&zoin_thread_init; - gate->scanhash = (void*)&scanhash_zoin; - gate->hash = (void*)&zoin_hash; - gate->hash_alt = (void*)&zoin_hash; + gate->miner_thread_init = (void*)&lyra2z330_thread_init; + gate->scanhash = (void*)&scanhash_lyra2z330; + gate->hash = (void*)&lyra2z330_hash; gate->get_max64 = (void*)&get_max64_0xffffLL; - gate->set_target = (void*)&zoin_set_target; + gate->set_target = (void*)&lyra2z330_set_target; return true; }; diff --git a/algo/lyra2/zcoin.c b/algo/lyra2/zcoin.c index 4568da7..4b3a2dc 100644 --- a/algo/lyra2/zcoin.c +++ b/algo/lyra2/zcoin.c @@ -115,7 +115,6 @@ bool register_zcoin_algo( algo_gate_t* gate ) gate->miner_thread_init = (void*)&zcoin_thread_init; gate->scanhash = (void*)&scanhash_zcoin; gate->hash = (void*)&zcoin_hash; - gate->hash_alt = (void*)&zcoin_hash; gate->get_max64 = (void*)&get_max64_0xffffLL; gate->set_target = (void*)&zcoin_set_target; // gate->prevent_dupes = (void*)&zcoin_get_work_height; diff --git a/algo/neoscrypt.c b/algo/neoscrypt.c index 228a202..b6c5a0f 100644 --- a/algo/neoscrypt.c +++ b/algo/neoscrypt.c @@ -1085,7 +1085,6 @@ bool register_neoscrypt_algo( algo_gate_t* gate ) { gate->scanhash = (void*)&scanhash_neoscrypt; gate->hash = (void*)&neoscrypt; - gate->hash_alt = (void*)&neoscrypt; gate->get_max64 = (void*)&get_neoscrypt_max64; gate->set_target = (void*)&scrypt_set_target; gate->wait_for_diff = (void*)&neoscrypt_wait_for_diff; diff --git a/algo/nist5.c b/algo/nist5.c index 3a48691..9c17706 100644 --- a/algo/nist5.c +++ b/algo/nist5.c @@ -155,7 +155,6 @@ bool register_nist5_algo( algo_gate_t* gate ) init_nist5_ctx(); gate->scanhash = (void*)&scanhash_nist5; gate->hash = (void*)&nist5hash; - gate->hash_alt = (void*)&nist5hash; return true; }; diff --git a/algo/quark/quark.c b/algo/quark/quark.c index 47e5062..a94aa60 100644 --- a/algo/quark/quark.c +++ b/algo/quark/quark.c @@ -173,83 +173,6 @@ inline static void quarkhash(void *state, const void *input) memcpy(state, hash, 32); } -void quarkhash_alt(void *state, const void *input) -{ - sph_blake512_context ctx_blake1, - ctx_blake2; - sph_bmw512_context ctx_bmw1, - ctx_bmw2; - sph_groestl512_context ctx_groestl1, - ctx_groestl2; - sph_skein512_context ctx_skein1, - ctx_skein2; - sph_jh512_context ctx_jh1, - ctx_jh2; - sph_keccak512_context ctx_keccak1, - ctx_keccak2; - - sph_blake512_init(&ctx_blake1); - sph_bmw512_init(&ctx_bmw1); - sph_groestl512_init(&ctx_groestl1); - sph_skein512_init(&ctx_skein1); - sph_groestl512_init(&ctx_groestl2); - sph_jh512_init(&ctx_jh1); - sph_blake512_init(&ctx_blake2); - sph_bmw512_init(&ctx_bmw2); - sph_keccak512_init(&ctx_keccak1); - sph_skein512_init(&ctx_skein2); - sph_keccak512_init(&ctx_keccak2); - sph_jh512_init(&ctx_jh2); - - uint32_t _ALIGN(128) hash[16]; - uint32_t mask = 8; - - - sph_blake512 (&ctx_blake1, input, 80); - sph_blake512_close (&ctx_blake1, hash); //0 - - sph_bmw512 (&ctx_bmw1, hash, 64); - sph_bmw512_close(&ctx_bmw1, hash); //1 - - if (hash[0] & mask) { - sph_groestl512 (&ctx_groestl1, hash, 64); - sph_groestl512_close(&ctx_groestl1, hash); //2 - } else { - sph_skein512 (&ctx_skein1, hash, 64); - sph_skein512_close(&ctx_skein1, hash); //2 - } - - sph_groestl512 (&ctx_groestl2, hash, 64); - sph_groestl512_close(&ctx_groestl2, hash); //3 - - sph_jh512 (&ctx_jh1, hash, 64); - sph_jh512_close(&ctx_jh1, hash); //4 - - if (hash[0] & mask) { - sph_blake512 (&ctx_blake2, hash, 64); - sph_blake512_close(&ctx_blake2, hash); //5 - } else { - sph_bmw512 (&ctx_bmw2, hash, 64); - sph_bmw512_close(&ctx_bmw2, hash); //5 - } - - sph_keccak512 (&ctx_keccak1, hash, 64); - sph_keccak512_close(&ctx_keccak1, hash); //6 - - sph_skein512 (&ctx_skein2, hash, 64); - sph_skein512_close(&ctx_skein2, hash); //7 - - if (hash[0] & mask) { - sph_keccak512 (&ctx_keccak2, hash, 64); - sph_keccak512_close(&ctx_keccak2, hash); //8 - } else { - sph_jh512 (&ctx_jh2, hash, 64); - sph_jh512_close(&ctx_jh2, hash); //8 - } - - memcpy(state, hash, 32); -} - int scanhash_quark( int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) { @@ -287,7 +210,6 @@ bool register_quark_algo( algo_gate_t* gate ) gate->optimizations = SSE2_OPT | AES_OPT; gate->scanhash = (void*)&scanhash_quark; gate->hash = (void*)&quarkhash; - gate->hash_alt = (void*)&quarkhash_alt; return true; }; diff --git a/algo/qubit/deep.c b/algo/qubit/deep.c index 6619bc0..2dbf44d 100644 --- a/algo/qubit/deep.c +++ b/algo/qubit/deep.c @@ -156,7 +156,6 @@ bool register_deep_algo( algo_gate_t* gate ) init_deep_ctx(); gate->scanhash = (void*)&scanhash_deep; gate->hash = (void*)&deep_hash; -// gate->hash_alt = (void*)&qubithash_alt; return true; }; diff --git a/algo/qubit/qubit.c b/algo/qubit/qubit.c index 347d397..c102b3a 100644 --- a/algo/qubit/qubit.c +++ b/algo/qubit/qubit.c @@ -91,39 +91,6 @@ void qubithash(void *output, const void *input) memcpy(output, hash, 32); } -void qubithash_alt(void *output, const void *input) -{ - sph_luffa512_context ctx_luffa; - sph_cubehash512_context ctx_cubehash; - sph_shavite512_context ctx_shavite; - sph_simd512_context ctx_simd; - sph_echo512_context ctx_echo; - - uint8_t hash[64]; - - sph_luffa512_init(&ctx_luffa); - sph_luffa512 (&ctx_luffa, input, 80); - sph_luffa512_close(&ctx_luffa, (void*) hash); - - sph_cubehash512_init(&ctx_cubehash); - sph_cubehash512 (&ctx_cubehash, (const void*) hash, 64); - sph_cubehash512_close(&ctx_cubehash, (void*) hash); - - sph_shavite512_init(&ctx_shavite); - sph_shavite512 (&ctx_shavite, (const void*) hash, 64); - sph_shavite512_close(&ctx_shavite, (void*) hash); - - sph_simd512_init(&ctx_simd); - sph_simd512 (&ctx_simd, (const void*) hash, 64); - sph_simd512_close(&ctx_simd, (void*) hash); - - sph_echo512_init(&ctx_echo); - sph_echo512 (&ctx_echo, (const void*) hash, 64); - sph_echo512_close(&ctx_echo, (void*) hash); - - memcpy(output, hash, 32); -} - int scanhash_qubit(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) { @@ -197,7 +164,6 @@ bool register_qubit_algo( algo_gate_t* gate ) init_qubit_ctx(); gate->scanhash = (void*)&scanhash_qubit; gate->hash = (void*)&qubithash; - gate->hash_alt = (void*)&qubithash_alt; return true; }; diff --git a/algo/s3.c b/algo/s3.c index ce2234e..775e729 100644 --- a/algo/s3.c +++ b/algo/s3.c @@ -110,7 +110,6 @@ bool register_s3_algo( algo_gate_t* gate ) algo_not_tested(); gate->scanhash = (void*)&scanhash_s3; gate->hash = (void*)&s3hash; - gate->hash_alt = (void*)&s3hash; // gate->get_max64 = &s3_get_max64; return true; }; diff --git a/algo/scrypt.c b/algo/scrypt.c index 40613df..d1f8bd3 100644 --- a/algo/scrypt.c +++ b/algo/scrypt.c @@ -781,7 +781,6 @@ bool register_scrypt_algo( algo_gate_t* gate ) gate->miner_thread_init =(void*)&scrypt_miner_thread_init; gate->scanhash = (void*)&scanhash_scrypt; gate->hash = (void*)&scrypt_1024_1_1_256_24way; - gate->hash_alt = (void*)&scrypt_1024_1_1_256_24way; gate->set_target = (void*)&scrypt_set_target; gate->get_max64 = (void*)&scrypt_get_max64; diff --git a/algo/scryptjane/scrypt-jane.c b/algo/scryptjane/scrypt-jane.c index 80187a7..aada06c 100644 --- a/algo/scryptjane/scrypt-jane.c +++ b/algo/scryptjane/scrypt-jane.c @@ -241,7 +241,6 @@ bool register_scryptjane_algo( algo_gate_t* gate ) { gate->scanhash = (void*)&scanhash_scryptjane; gate->hash = (void*)&scryptjanehash; - gate->hash_alt = (void*)&scryptjanehash; gate->set_target = (void*)&scrypt_set_target; gate->get_max64 = (void*)&get_max64_0x40LL; diff --git a/algo/sha2/sha2.c b/algo/sha2/sha2.c index d7af63b..5126122 100644 --- a/algo/sha2/sha2.c +++ b/algo/sha2/sha2.c @@ -640,7 +640,6 @@ int scanhash_sha256d(int thr_id, struct work *work, bool register_sha256d_algo( algo_gate_t* gate ) { gate->scanhash = (void*)&scanhash_sha256d; - gate->hash_alt = (void*)&sha256d; gate->hash = (void*)&sha256d; return true; }; diff --git a/algo/sha2/sha256t.c b/algo/sha2/sha256t.c index 6a8818f..b6eebbf 100644 --- a/algo/sha2/sha256t.c +++ b/algo/sha2/sha256t.c @@ -136,7 +136,6 @@ bool register_sha256t_algo( algo_gate_t* gate ) sph_sha256_init( &sha256t_ctx ); gate->scanhash = (void*)&scanhash_sha256t; gate->hash = (void*)&sha256t_hash; - gate->hash_alt = (void*)&sha256t_hash; gate->set_target = (void*)&sha256t_set_target; gate->get_max64 = (void*)&get_max64_0x3ffff; return true; diff --git a/algo/veltor.c b/algo/veltor.c index 60b1005..65bf209 100644 --- a/algo/veltor.c +++ b/algo/veltor.c @@ -109,7 +109,6 @@ bool register_veltor_algo( algo_gate_t* gate ) init_veltor_ctx(); gate->scanhash = (void*)&scanhash_veltor; gate->hash = (void*)&veltorhash; - gate->hash_alt = (void*)&veltorhash; gate->get_max64 = (void*)&get_max64_0x3ffff; return true; } diff --git a/algo/x11/c11.c b/algo/x11/c11.c index f847d49..c26ee99 100644 --- a/algo/x11/c11.c +++ b/algo/x11/c11.c @@ -138,69 +138,6 @@ void c11hash( void *output, const void *input ) memcpy(output, hash+64, 32); } -void c11hash_alt( void *output, const void *input ) -{ - unsigned char hash[128]; - sph_blake512_context ctx_blake; - sph_bmw512_context ctx_bmw; - sph_groestl512_context ctx_groestl; - sph_skein512_context ctx_skein; - sph_jh512_context ctx_jh; - sph_keccak512_context ctx_keccak; - sph_luffa512_context ctx_luffa1; - sph_cubehash512_context ctx_cubehash1; - sph_shavite512_context ctx_shavite1; - sph_simd512_context ctx_simd1; - sph_echo512_context ctx_echo; - - - sph_blake512_init(&ctx_blake); - sph_blake512 (&ctx_blake, input, 80); - sph_blake512_close (&ctx_blake, hash); - - sph_bmw512_init(&ctx_bmw); - sph_bmw512 (&ctx_bmw, hash, 64); - sph_bmw512_close(&ctx_bmw, hash); - - sph_groestl512_init(&ctx_groestl); - sph_groestl512 (&ctx_groestl, hash, 64); - sph_groestl512_close(&ctx_groestl, hash); - - sph_jh512_init(&ctx_jh); - sph_jh512 (&ctx_jh, hash, 64); - sph_jh512_close(&ctx_jh, hash); - - sph_keccak512_init(&ctx_keccak); - sph_keccak512 (&ctx_keccak, hash, 64); - sph_keccak512_close(&ctx_keccak, hash); - - sph_skein512_init(&ctx_skein); - sph_skein512 (&ctx_skein, hash, 64); - sph_skein512_close (&ctx_skein, hash); - - sph_luffa512_init (&ctx_luffa1); - sph_luffa512 (&ctx_luffa1, hash, 64); - sph_luffa512_close (&ctx_luffa1, hash); - - sph_cubehash512_init (&ctx_cubehash1); - sph_cubehash512 (&ctx_cubehash1, hash, 64); - sph_cubehash512_close(&ctx_cubehash1, hash); - - sph_shavite512_init (&ctx_shavite1); - sph_shavite512 (&ctx_shavite1, hash, 64); - sph_shavite512_close(&ctx_shavite1, hash); - - sph_simd512_init (&ctx_simd1); - sph_simd512 (&ctx_simd1, hash, 64); - sph_simd512_close(&ctx_simd1, hash); - - sph_echo512_init (&ctx_echo); - sph_echo512 (&ctx_echo, hash, 64); - sph_echo512_close(&ctx_echo, hash); - - memcpy(output, hash+64, 32); -} - int scanhash_c11( int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done ) { @@ -241,7 +178,6 @@ bool register_c11_algo( algo_gate_t* gate ) init_c11_ctx(); gate->scanhash = (void*)&scanhash_c11; gate->hash = (void*)&c11hash; - gate->hash_alt = (void*)&c11hash_alt; gate->get_max64 = (void*)&get_max64_0x3ffff; return true; }; diff --git a/algo/x11/x11.c b/algo/x11/x11.c index a2532bd..c166f3a 100644 --- a/algo/x11/x11.c +++ b/algo/x11/x11.c @@ -136,71 +136,6 @@ static void x11_hash( void *state, const void *input ) memcpy( state, hash+64, 32 ); } - -static void x11hash_alt( void *output, const void *input ) -{ - sph_blake512_context ctx_blake; - sph_bmw512_context ctx_bmw; - sph_groestl512_context ctx_groestl; - sph_skein512_context ctx_skein; - sph_jh512_context ctx_jh; - sph_keccak512_context ctx_keccak; - - sph_luffa512_context ctx_luffa1; - sph_cubehash512_context ctx_cubehash1; - sph_shavite512_context ctx_shavite1; - sph_simd512_context ctx_simd1; - sph_echo512_context ctx_echo1; - - uint32_t _ALIGN(64) hashA[16], hashB[16]; - - sph_blake512_init(&ctx_blake); - sph_blake512 (&ctx_blake, input, 80); - sph_blake512_close (&ctx_blake, hashA); - - sph_bmw512_init(&ctx_bmw); - sph_bmw512 (&ctx_bmw, hashA, 64); - sph_bmw512_close(&ctx_bmw, hashB); - - sph_groestl512_init(&ctx_groestl); - sph_groestl512 (&ctx_groestl, hashB, 64); - sph_groestl512_close(&ctx_groestl, hashA); - - sph_skein512_init(&ctx_skein); - sph_skein512 (&ctx_skein, hashA, 64); - sph_skein512_close (&ctx_skein, hashB); - - sph_jh512_init(&ctx_jh); - sph_jh512 (&ctx_jh, hashB, 64); - sph_jh512_close(&ctx_jh, hashA); - - sph_keccak512_init(&ctx_keccak); - sph_keccak512 (&ctx_keccak, hashA, 64); - sph_keccak512_close(&ctx_keccak, hashB); - - sph_luffa512_init (&ctx_luffa1); - sph_luffa512 (&ctx_luffa1, hashB, 64); - sph_luffa512_close (&ctx_luffa1, hashA); - - sph_cubehash512_init (&ctx_cubehash1); - sph_cubehash512 (&ctx_cubehash1, hashA, 64); - sph_cubehash512_close(&ctx_cubehash1, hashB); - - sph_shavite512_init (&ctx_shavite1); - sph_shavite512 (&ctx_shavite1, hashB, 64); - sph_shavite512_close(&ctx_shavite1, hashA); - - sph_simd512_init (&ctx_simd1); - sph_simd512 (&ctx_simd1, hashA, 64); - sph_simd512_close(&ctx_simd1, hashB); - - sph_echo512_init (&ctx_echo1); - sph_echo512 (&ctx_echo1, hashB, 64); - sph_echo512_close(&ctx_echo1, hashA); - - memcpy(output, hashA, 32); -} - int scanhash_x11( int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done ) { @@ -263,7 +198,6 @@ bool register_x11_algo( algo_gate_t* gate ) gate->scanhash = (void*)&scanhash_x11; gate->hash = (void*)&x11_hash; gate->get_max64 = (void*)&get_max64_0x3ffff; - gate->hash_alt = (void*)&x11hash_alt; return true; }; diff --git a/algo/x11/x11evo.c b/algo/x11/x11evo.c index e4e516b..19bad71 100644 --- a/algo/x11/x11evo.c +++ b/algo/x11/x11evo.c @@ -303,7 +303,6 @@ bool register_x11evo_algo( algo_gate_t* gate ) gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | AVX2_OPT; gate->scanhash = (void*)&scanhash_x11evo; gate->hash = (void*)&x11evo_hash; - gate->hash_alt = (void*)&x11evo_hash; init_x11evo_ctx(); return true; }; diff --git a/algo/x11/x11gost.c b/algo/x11/x11gost.c index 368cc3d..8f8ce09 100644 --- a/algo/x11/x11gost.c +++ b/algo/x11/x11gost.c @@ -179,7 +179,6 @@ bool register_sib_algo( algo_gate_t* gate ) init_sib_ctx(); gate->scanhash = (void*)&scanhash_sib; gate->hash = (void*)&sibhash; - gate->hash_alt = (void*)&sibhash; gate->get_max64 = (void*)&get_max64_0x3ffff; return true; } diff --git a/algo/x13/x13.c b/algo/x13/x13.c index 8da6019..e1947d6 100644 --- a/algo/x13/x13.c +++ b/algo/x13/x13.c @@ -175,79 +175,6 @@ static void x13hash(void *output, const void *input) memcpy(output, hashB, 32); } -void x13hash_alt(void *output, const void *input) -{ - unsigned char hash[128]; // uint32_t hashA[16], hashB[16]; - #define hashB hash+64 - - sph_blake512_context ctx_blake; - sph_bmw512_context ctx_bmw; - sph_groestl512_context ctx_groestl; - sph_jh512_context ctx_jh; - sph_keccak512_context ctx_keccak; - sph_skein512_context ctx_skein; - sph_luffa512_context ctx_luffa; - sph_cubehash512_context ctx_cubehash; - sph_shavite512_context ctx_shavite; - sph_simd512_context ctx_simd; - sph_echo512_context ctx_echo; - sph_hamsi512_context ctx_hamsi; - sph_fugue512_context ctx_fugue; - - sph_blake512_init(&ctx_blake); - sph_blake512(&ctx_blake, input, 80); - sph_blake512_close(&ctx_blake, hash); - - sph_bmw512_init(&ctx_bmw); - sph_bmw512(&ctx_bmw, hash, 64); - sph_bmw512_close(&ctx_bmw, hashB); - - sph_groestl512_init(&ctx_groestl); - sph_groestl512(&ctx_groestl, hashB, 64); - sph_groestl512_close(&ctx_groestl, hash); - - sph_skein512_init(&ctx_skein); - sph_skein512(&ctx_skein, hash, 64); - sph_skein512_close(&ctx_skein, hashB); - - sph_jh512_init(&ctx_jh); - sph_jh512(&ctx_jh, hashB, 64); - sph_jh512_close(&ctx_jh, hash); - - sph_keccak512_init(&ctx_keccak); - sph_keccak512(&ctx_keccak, hash, 64); - sph_keccak512_close(&ctx_keccak, hashB); - - sph_luffa512_init(&ctx_luffa); - sph_luffa512(&ctx_luffa, hashB, 64); - sph_luffa512_close(&ctx_luffa, hash); - - sph_cubehash512_init(&ctx_cubehash); - sph_cubehash512(&ctx_cubehash, hash, 64); - sph_cubehash512_close(&ctx_cubehash, hashB); - - sph_shavite512_init(&ctx_shavite); - sph_shavite512(&ctx_shavite, hashB, 64); - sph_shavite512_close(&ctx_shavite, hash); - sph_simd512_init(&ctx_simd); - sph_simd512(&ctx_simd, hash, 64); - sph_simd512_close(&ctx_simd, hashB); - - sph_echo512_init(&ctx_echo); - sph_echo512(&ctx_echo, hashB, 64); - sph_echo512_close(&ctx_echo, hash); - sph_hamsi512_init(&ctx_hamsi); - sph_hamsi512(&ctx_hamsi, hash, 64); - sph_hamsi512_close(&ctx_hamsi, hashB); - - sph_fugue512_init(&ctx_fugue); - sph_fugue512(&ctx_fugue, hashB, 64); - sph_fugue512_close(&ctx_fugue, hash); - - memcpy(output, hash, 32); -} - - int scanhash_x13(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) { @@ -331,7 +258,6 @@ bool register_x13_algo( algo_gate_t* gate ) init_x13_ctx(); gate->scanhash = (void*)&scanhash_x13; gate->hash = (void*)&x13hash; - gate->hash_alt = (void*)&x13hash_alt; gate->get_max64 = (void*)&get_max64_0x3ffff; return true; }; diff --git a/algo/x14/x14.c b/algo/x14/x14.c index cc145be..a105181 100644 --- a/algo/x14/x14.c +++ b/algo/x14/x14.c @@ -182,86 +182,6 @@ static void x14hash(void *output, const void *input) memcpy(output, hash, 32); } -void x14hash_alt(void *output, const void *input) -{ - unsigned char hash[128]; // uint32_t hashA[16], hashB[16]; - #define hashB hash+64 - - sph_blake512_context ctx_blake; - sph_bmw512_context ctx_bmw; - sph_groestl512_context ctx_groestl; - sph_jh512_context ctx_jh; - sph_keccak512_context ctx_keccak; - sph_skein512_context ctx_skein; - sph_luffa512_context ctx_luffa; - sph_cubehash512_context ctx_cubehash; - sph_shavite512_context ctx_shavite; - sph_simd512_context ctx_simd; - sph_echo512_context ctx_echo; - sph_hamsi512_context ctx_hamsi; - sph_fugue512_context ctx_fugue; - sph_shabal512_context ctx_shabal; - - sph_blake512_init(&ctx_blake); - sph_blake512(&ctx_blake, input, 80); - sph_blake512_close(&ctx_blake, hash); - - sph_bmw512_init(&ctx_bmw); - sph_bmw512(&ctx_bmw, hash, 64); - sph_bmw512_close(&ctx_bmw, hashB); - - sph_groestl512_init(&ctx_groestl); - sph_groestl512(&ctx_groestl, hashB, 64); - sph_groestl512_close(&ctx_groestl, hash); - - sph_skein512_init(&ctx_skein); - sph_skein512(&ctx_skein, hash, 64); - sph_skein512_close(&ctx_skein, hashB); - - sph_jh512_init(&ctx_jh); - sph_jh512(&ctx_jh, hashB, 64); - sph_jh512_close(&ctx_jh, hash); - - sph_keccak512_init(&ctx_keccak); - sph_keccak512(&ctx_keccak, hash, 64); - sph_keccak512_close(&ctx_keccak, hashB); - - sph_luffa512_init(&ctx_luffa); - sph_luffa512(&ctx_luffa, hashB, 64); - sph_luffa512_close(&ctx_luffa, hash); - - sph_cubehash512_init(&ctx_cubehash); - sph_cubehash512(&ctx_cubehash, hash, 64); - sph_cubehash512_close(&ctx_cubehash, hashB); - - sph_shavite512_init(&ctx_shavite); - sph_shavite512(&ctx_shavite, hashB, 64); - sph_shavite512_close(&ctx_shavite, hash); - - sph_simd512_init(&ctx_simd); - sph_simd512(&ctx_simd, hash, 64); - sph_simd512_close(&ctx_simd, hashB); - - sph_echo512_init(&ctx_echo); - sph_echo512(&ctx_echo, hashB, 64); - sph_echo512_close(&ctx_echo, hash); - - sph_hamsi512_init(&ctx_hamsi); - sph_hamsi512(&ctx_hamsi, hash, 64); - sph_hamsi512_close(&ctx_hamsi, hashB); - - sph_fugue512_init(&ctx_fugue); - sph_fugue512(&ctx_fugue, hashB, 64); - sph_fugue512_close(&ctx_fugue, hash); - - sph_shabal512_init(&ctx_shabal); - sph_shabal512(&ctx_shabal, hash, 64); - sph_shabal512_close(&ctx_shabal, hash); - - memcpy(output, hash, 32); -} - - int scanhash_x14(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) { @@ -336,7 +256,6 @@ bool register_x14_algo( algo_gate_t* gate ) init_x14_ctx(); gate->scanhash = (void*)&scanhash_x14; gate->hash = (void*)&x14hash; - gate->hash_alt = (void*)&x14hash_alt; gate->get_max64 = (void*)&get_max64_0x3ffff; return true; }; diff --git a/algo/x15/x15.c b/algo/x15/x15.c index 4904ea8..ba92859 100644 --- a/algo/x15/x15.c +++ b/algo/x15/x15.c @@ -187,89 +187,6 @@ static void x15hash(void *output, const void *input) memcpy(output, hashB, 32); } -void x15hash_alt(void *output, const void *input) -{ - unsigned char hash[128]; // uint32_t hashA[16], hashB[16]; - #define hashB hash+64 - - sph_blake512_context ctx_blake; - sph_bmw512_context ctx_bmw; - sph_groestl512_context ctx_groestl; - sph_jh512_context ctx_jh; - sph_keccak512_context ctx_keccak; - sph_skein512_context ctx_skein; - sph_luffa512_context ctx_luffa; - sph_cubehash512_context ctx_cubehash; - sph_shavite512_context ctx_shavite; - sph_simd512_context ctx_simd; - sph_echo512_context ctx_echo; - sph_hamsi512_context ctx_hamsi; - sph_fugue512_context ctx_fugue; - sph_shabal512_context ctx_shabal; - sph_whirlpool_context ctx_whirlpool; - - sph_blake512_init(&ctx_blake); - sph_blake512(&ctx_blake, input, 80); - sph_blake512_close(&ctx_blake, hash); - - sph_bmw512_init(&ctx_bmw); - sph_bmw512(&ctx_bmw, hash, 64); - sph_bmw512_close(&ctx_bmw, hashB); - - sph_groestl512_init(&ctx_groestl); - sph_groestl512(&ctx_groestl, hashB, 64); - sph_groestl512_close(&ctx_groestl, hash); - - sph_skein512_init(&ctx_skein); - sph_skein512(&ctx_skein, hash, 64); - sph_skein512_close(&ctx_skein, hashB); - - sph_jh512_init(&ctx_jh); - sph_jh512(&ctx_jh, hashB, 64); - sph_jh512_close(&ctx_jh, hash); - - sph_keccak512_init(&ctx_keccak); - sph_keccak512(&ctx_keccak, hash, 64); - sph_keccak512_close(&ctx_keccak, hashB); - sph_luffa512_init(&ctx_luffa); - sph_luffa512(&ctx_luffa, hashB, 64); - sph_luffa512_close(&ctx_luffa, hash); - - sph_cubehash512_init(&ctx_cubehash); - sph_cubehash512(&ctx_cubehash, hash, 64); - sph_cubehash512_close(&ctx_cubehash, hashB); - - sph_shavite512_init(&ctx_shavite); - sph_shavite512(&ctx_shavite, hashB, 64); - sph_shavite512_close(&ctx_shavite, hash); - - sph_simd512_init(&ctx_simd); - sph_simd512(&ctx_simd, hash, 64); - sph_simd512_close(&ctx_simd, hashB); - - sph_echo512_init(&ctx_echo); - sph_echo512(&ctx_echo, hashB, 64); - sph_echo512_close(&ctx_echo, hash); - - sph_hamsi512_init(&ctx_hamsi); - sph_hamsi512(&ctx_hamsi, hash, 64); - sph_hamsi512_close(&ctx_hamsi, hashB); - - sph_fugue512_init(&ctx_fugue); - sph_fugue512(&ctx_fugue, hashB, 64); - sph_fugue512_close(&ctx_fugue, hash); - - sph_shabal512_init(&ctx_shabal); - sph_shabal512(&ctx_shabal, hash, 64); - sph_shabal512_close(&ctx_shabal, hashB); - - sph_whirlpool_init(&ctx_whirlpool); - sph_whirlpool(&ctx_whirlpool, hashB, 64); - sph_whirlpool_close(&ctx_whirlpool, hash); - - memcpy(output, hash, 32); -} - int scanhash_x15(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) { @@ -351,7 +268,6 @@ bool register_x15_algo( algo_gate_t* gate ) init_x15_ctx(); gate->scanhash = (void*)&scanhash_x15; gate->hash = (void*)&x15hash; - gate->hash_alt = (void*)&x15hash_alt; return true; }; diff --git a/algo/x17/x17.c b/algo/x17/x17.c index fc015a1..692b651 100644 --- a/algo/x17/x17.c +++ b/algo/x17/x17.c @@ -198,100 +198,6 @@ static void x17hash(void *output, const void *input) memcpy(output, hashB, 32); } -void x17hash_alt(void *output, const void *input) -{ - unsigned char hash[128]; // uint32_t hashA[16], hashB[16]; - #define hashB hash+64 - - sph_blake512_context ctx_blake; - sph_bmw512_context ctx_bmw; - sph_groestl512_context ctx_groestl; - sph_jh512_context ctx_jh; - sph_keccak512_context ctx_keccak; - sph_skein512_context ctx_skein; - sph_luffa512_context ctx_luffa; - sph_cubehash512_context ctx_cubehash; - sph_shavite512_context ctx_shavite; - sph_simd512_context ctx_simd; - sph_echo512_context ctx_echo; - sph_hamsi512_context ctx_hamsi; - sph_fugue512_context ctx_fugue; - sph_shabal512_context ctx_shabal; - sph_whirlpool_context ctx_whirlpool; - sph_sha512_context ctx_sha512; - sph_haval256_5_context ctx_haval; - - sph_blake512_init(&ctx_blake); - sph_blake512(&ctx_blake, input, 80); - sph_blake512_close(&ctx_blake, hash); - - sph_bmw512_init(&ctx_bmw); - sph_bmw512(&ctx_bmw, hash, 64); - sph_bmw512_close(&ctx_bmw, hashB); - - sph_groestl512_init(&ctx_groestl); - sph_groestl512(&ctx_groestl, hashB, 64); - sph_groestl512_close(&ctx_groestl, hash); - - sph_skein512_init(&ctx_skein); - sph_skein512(&ctx_skein, hash, 64); - sph_skein512_close(&ctx_skein, hashB); - - sph_jh512_init(&ctx_jh); - sph_jh512(&ctx_jh, hashB, 64); - sph_jh512_close(&ctx_jh, hash); - - sph_keccak512_init(&ctx_keccak); - sph_keccak512(&ctx_keccak, hash, 64); - sph_keccak512_close(&ctx_keccak, hashB); - - sph_luffa512_init(&ctx_luffa); - sph_luffa512(&ctx_luffa, hashB, 64); - sph_luffa512_close(&ctx_luffa, hash); - - sph_cubehash512_init(&ctx_cubehash); - sph_cubehash512(&ctx_cubehash, hash, 64); - sph_cubehash512_close(&ctx_cubehash, hashB); - - sph_shavite512_init(&ctx_shavite); - sph_shavite512(&ctx_shavite, hashB, 64); - sph_shavite512_close(&ctx_shavite, hash); - - sph_simd512_init(&ctx_simd); - sph_simd512(&ctx_simd, hash, 64); - sph_simd512_close(&ctx_simd, hashB); - - sph_echo512_init(&ctx_echo); - sph_echo512(&ctx_echo, hashB, 64); - sph_echo512_close(&ctx_echo, hash); - - sph_hamsi512_init(&ctx_hamsi); - sph_hamsi512(&ctx_hamsi, hash, 64); - sph_hamsi512_close(&ctx_hamsi, hashB); - - sph_fugue512_init(&ctx_fugue); - sph_fugue512(&ctx_fugue, hashB, 64); - sph_fugue512_close(&ctx_fugue, hash); - - sph_shabal512_init(&ctx_shabal); - sph_shabal512(&ctx_shabal, hash, 64); - sph_shabal512_close(&ctx_shabal, hashB); - - sph_whirlpool_init(&ctx_whirlpool); - sph_whirlpool(&ctx_whirlpool, hashB, 64); - sph_whirlpool_close(&ctx_whirlpool, hash); - - sph_sha512_init(&ctx_sha512); - sph_sha512(&ctx_sha512,(const void*) hash, 64); - sph_sha512_close(&ctx_sha512,(void*) hash); - - sph_haval256_5_init(&ctx_haval); - sph_haval256_5(&ctx_haval,(const void*) hash, 64); - sph_haval256_5_close(&ctx_haval,hash); - - memcpy(output, hash, 32); -} - int scanhash_x17(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *hashes_done) { @@ -373,7 +279,6 @@ bool register_x17_algo( algo_gate_t* gate ) init_x17_ctx(); gate->scanhash = (void*)&scanhash_x17; gate->hash = (void*)&x17hash; - gate->hash_alt = (void*)&x17hash_alt; return true; }; diff --git a/algo/yescrypt/yescrypt.c b/algo/yescrypt/yescrypt.c index a175070..a76a612 100644 --- a/algo/yescrypt/yescrypt.c +++ b/algo/yescrypt/yescrypt.c @@ -53,7 +53,6 @@ bool register_yescrypt_algo ( algo_gate_t* gate ) { gate->scanhash = (void*)&scanhash_yescrypt; gate->hash = (void*)&yescrypt_hash; - gate->hash_alt = (void*)&yescrypthash; gate->set_target = (void*)&scrypt_set_target; gate->get_max64 = (void*)&yescrypt_get_max64; return true; diff --git a/algo/zr5.c b/algo/zr5.c index e72b5e7..7ab8575 100644 --- a/algo/zr5.c +++ b/algo/zr5.c @@ -226,7 +226,6 @@ bool register_zr5_algo( algo_gate_t* gate ) gate->get_new_work = (void*)&zr5_get_new_work; gate->scanhash = (void*)&scanhash_zr5; gate->hash = (void*)&zr5hash; - gate->hash_alt = (void*)&zr5hash; gate->get_max64 = (void*)&zr5_get_max64; gate->display_extra_data = (void*)&zr5_display_pok; gate->build_stratum_request = (void*)&std_be_build_stratum_request; diff --git a/configure.ac b/configure.ac index 3b97840..2add3ef 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([cpuminer-opt], [3.5.13]) +AC_INIT([cpuminer-opt], [3.6.0]) AC_PREREQ([2.59c]) AC_CANONICAL_SYSTEM diff --git a/cpu-miner.c b/cpu-miner.c index 699c3be..f5f49fe 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -276,18 +276,16 @@ void work_copy(struct work *dest, const struct work *src) } } -bool jr2_work_decode( const json_t *val, struct work *work) -{ - return rpc2_job_decode(val, work); -} +bool jr2_work_decode( const json_t *val, struct work *work ) +{ return rpc2_job_decode( val, work ); } -bool std_work_decode( const json_t *val, struct work *work) +bool std_work_decode( const json_t *val, struct work *work ) { int i; - int data_size = algo_gate.work_data_size; - int target_size = sizeof(work->target); - int adata_sz = ARRAY_SIZE(work->data); - int atarget_sz = ARRAY_SIZE(work->target); + const int data_size = algo_gate.work_data_size; + const int target_size = sizeof(work->target); + const int adata_sz = data_size / 4; + const int atarget_sz = ARRAY_SIZE(work->target); if (unlikely( !jobj_binary(val, "data", work->data, data_size) )) { @@ -306,13 +304,13 @@ bool std_work_decode( const json_t *val, struct work *work) return true; } -static bool work_decode(const json_t *val, struct work *work) +static bool work_decode( const json_t *val, struct work *work ) { if ( !algo_gate.work_decode( val, work ) ) return false; if ( !allow_mininginfo ) net_diff = algo_gate.calc_network_diff( work ); - work->targetdiff = target_to_diff(work->target); + work->targetdiff = target_to_diff( work->target ); // for api stats, on longpoll pools stratum_diff = work->targetdiff; algo_gate.display_extra_data( work, &net_blocks ); @@ -816,7 +814,7 @@ void std_le_build_stratum_request( char *req, struct work *work ) le32enc( &nonce, work->data[ algo_gate.nonce_index ] ); bin2hex( ntimestr, (char*)(&ntime), sizeof(uint32_t) ); bin2hex( noncestr, (char*)(&nonce), sizeof(uint32_t) ); - xnonce2str = abin2hex(work->xnonce2, work->xnonce2_len); + xnonce2str = abin2hex( work->xnonce2, work->xnonce2_len ); snprintf( req, JSON_BUF_LEN, "{\"method\": \"mining.submit\", \"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}", rpc_user, work->job_id, xnonce2str, ntimestr, noncestr ); @@ -833,7 +831,7 @@ void std_be_build_stratum_request( char *req, struct work *work ) be32enc( &nonce, work->data[ algo_gate.nonce_index ] ); bin2hex( ntimestr, (char*)(&ntime), sizeof(uint32_t) ); bin2hex( noncestr, (char*)(&nonce), sizeof(uint32_t) ); - xnonce2str = abin2hex(work->xnonce2, work->xnonce2_len); + xnonce2str = abin2hex( work->xnonce2, work->xnonce2_len ); snprintf( req, JSON_BUF_LEN, "{\"method\": \"mining.submit\", \"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\":4}", rpc_user, work->job_id, xnonce2str, ntimestr, noncestr ); @@ -880,11 +878,11 @@ bool std_submit_getwork_result( CURL *curl, struct work *work ) applog(LOG_ERR, "submit_upstream_work json_rpc_call failed"); return false; } - res = json_object_get(val, "result"); - reason = json_object_get(val, "reject-reason"); - share_result( json_is_true(res), work, - reason ? json_string_value(reason) : NULL); - json_decref(val); + res = json_object_get( val, "result" ); + reason = json_object_get( val, "reject-reason" ); + share_result( json_is_true( res ), work, + reason ? json_string_value( reason ) : NULL ); + json_decref( val ); return true; } @@ -1308,14 +1306,12 @@ static bool get_work(struct thr_info *thr, struct work *work) uint32_t ts = (uint32_t) time(NULL); // why 74? std cmp_size is 76, std data is 128 - for (int n=0; n<74; n++) ((char*)work->data)[n] = n; + for ( int n = 0; n < 74; n++ ) ( (char*)work->data )[n] = n; -// work->data[algo_gate.ntime_index] = swab32(ts); // ntime - work->data[17] = swab32(ts); // ntime + work->data[algo_gate.ntime_index] = swab32(ts); // ntime // this overwrites much of the for loop init -// memset( work->data + algo_gate.nonce_index, 0x00, 52); // nonce..nonce+52 - memset(work->data + 19, 0x00, 52); // nonce..nonce+52 + memset( work->data + algo_gate.nonce_index, 0x00, 52); // nonce..nonce+52 work->data[20] = 0x80000000; // extraheader not used for jr2 work->data[31] = 0x00000280; // extraheader not used for jr2 return true; @@ -1641,10 +1637,11 @@ static void *miner_thread( void *userdata ) uint64_t hashes_done; struct timeval tv_start, tv_end, diff; int64_t max64; - int nonce_found = 0; + bool nonce_found = false; + if ( algo_gate.do_this_thread( thr_id ) ) { - if (have_stratum) + if ( have_stratum ) { algo_gate.wait_for_diff( &stratum ); pthread_mutex_lock( &g_work_lock ); @@ -1655,25 +1652,22 @@ static void *miner_thread( void *userdata ) else { int min_scantime = have_longpoll ? LP_SCANTIME : opt_scantime; - pthread_mutex_lock(&g_work_lock); - if ( !have_stratum - && ( time(NULL) - g_work_time >= min_scantime - || work.data[19] >= end_nonce ) ) + pthread_mutex_lock( &g_work_lock ); + + if ( time(NULL) - g_work_time >= min_scantime + || *algo_gate.get_nonceptr( work.data ) >= end_nonce ) { - if (unlikely( !get_work(mythr, &g_work) )) + if ( unlikely( !get_work( mythr, &g_work ) ) ) { - applog(LOG_ERR, "work retrieval failed, exiting " - "mining thread %d", mythr->id); - pthread_mutex_unlock(&g_work_lock); + applog( LOG_ERR, "work retrieval failed, exiting " + "mining thread %d", thr_id ); + pthread_mutex_unlock( &g_work_lock ); goto out; } - g_work_time = have_stratum ? 0 : time(NULL); + g_work_time = time(NULL); } - if (have_stratum) - { - pthread_mutex_unlock(&g_work_lock); - continue; - } + algo_gate.get_new_work( &work, &g_work, thr_id, &end_nonce, true ); + pthread_mutex_unlock( &g_work_lock ); } } // do_this_thread @@ -1681,16 +1675,6 @@ static void *miner_thread( void *userdata ) if ( !algo_gate.ready_to_mine( &work, &stratum, thr_id ) ) continue; -/* - if ( algo_gate.prevent_dupes( &work, &stratum, thr_id ) ) - continue; - // prevent scans before a job is received - if (have_stratum && !work.data[0] && !opt_benchmark) - { - sleep(1); - continue; - } -*/ // conditional mining if (!wanna_mine(thr_id)) { @@ -1704,13 +1688,13 @@ static void *miner_thread( void *userdata ) max64 = g_work_time + ( have_longpoll ? LP_SCANTIME : opt_scantime ) - time(NULL); // time limit - if (opt_time_limit && firstwork_time) + if ( opt_time_limit && firstwork_time ) { - int passed = (int)(time(NULL) - firstwork_time); - int remain = (int)(opt_time_limit - passed); - if (remain < 0) + int passed = (int)( time(NULL) - firstwork_time ); + int remain = (int)( opt_time_limit - passed ); + if ( remain < 0 ) { - if (thr_id != 0) + if ( thr_id != 0 ) { sleep(1); continue; @@ -1718,8 +1702,8 @@ static void *miner_thread( void *userdata ) if (opt_benchmark) { char rate[32]; - format_hashrate(global_hashrate, rate); - applog(LOG_NOTICE, "Benchmark: %s", rate); + format_hashrate( global_hashrate, rate ); + applog( LOG_NOTICE, "Benchmark: %s", rate ); fprintf(stderr, "%llu\n", (unsigned long long)global_hashrate); } else @@ -1730,24 +1714,24 @@ static void *miner_thread( void *userdata ) if (remain < max64) max64 = remain; } // max64 - uint32_t work_nonce = *(algo_gate.get_nonceptr( work.data ) ); + uint32_t work_nonce = *( algo_gate.get_nonceptr( work.data ) ); max64 *= thr_hashrates[thr_id]; if ( max64 <= 0) max64 = (int64_t)algo_gate.get_max64(); if ( work_nonce + max64 > end_nonce ) max_nonce = end_nonce; else - max_nonce = work_nonce + (uint32_t) max64; + max_nonce = work_nonce + (uint32_t)max64; // init time - if (firstwork_time == 0) + if ( firstwork_time == 0 ) firstwork_time = time(NULL); work_restart[thr_id].restart = 0; hashes_done = 0; - gettimeofday((struct timeval *) &tv_start, NULL); + gettimeofday( (struct timeval *) &tv_start, NULL ); - // Scanhash - nonce_found = (int) algo_gate.scanhash( thr_id, &work, max_nonce, - &hashes_done ); + // Scan for nonce + nonce_found = (bool) algo_gate.scanhash( thr_id, &work, max_nonce, + &hashes_done ); // record scanhash elapsed time gettimeofday(&tv_end, NULL); @@ -2928,16 +2912,6 @@ int main(int argc, char *argv[]) if (!opt_n_threads) opt_n_threads = num_cpus; -/* - // All options must be set before starting the gate - if ( !register_algo_gate( opt_algo, &algo_gate ) ) - { - exit(1); - } - - if ( !check_cpu_capability() ) - exit(1); -*/ if ( opt_algo == ALGO_NULL ) { fprintf(stderr, "%s: no algo supplied\n", argv[0]);