From b7db07f434a24c305db3bd4a554f1931c4284790 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Tue, 6 Feb 2018 21:16:11 +0300 Subject: [PATCH] fix linux build and stratum merkle calculation --- INSTALL | 2 +- Makefile.am | 2 +- ccminer.cpp | 19 +++++++------------ ccminer.vcxproj | 2 +- miner.h | 7 +++---- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/INSTALL b/INSTALL index 85724a7..e9fcbfa 100644 --- a/INSTALL +++ b/INSTALL @@ -79,7 +79,7 @@ make -j 8 && make install ./ccminer -n -** Arch Linux notice ** +** Arch Linux notice (need to be checked)** For Arch Linux needed add some flags when configuring sources extracflags="-march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16" CPPFLAGS='-I/usr/include/openssl-1.0' \ LDFLAGS='-L/usr/lib/openssl-1.0 -L/usr/lib' \ diff --git a/Makefile.am b/Makefile.am index 75960f7..fb84567 100644 --- a/Makefile.am +++ b/Makefile.am @@ -78,7 +78,7 @@ ccminer_SOURCES = elist.h miner.h compat.h \ x15/whirlpool.cu x15/cuda_x15_whirlpool_sm3.cu \ x17/x17.cu x17/hmq17.cu x17/cuda_x17_haval256.cu x17/cuda_x17_sha512.cu \ x11/phi.cu x11/cuda_streebog_maxwell.cu \ - x11/c11.cu x11/s3.cu x11/sib.cu x11/veltor.cu x11/cuda_streebog.cu + x11/c11.cu x11/s3.cu x11/sib.cu x11/veltor.cu x11/cuda_streebog.cu \ gost/gost.cu gost/cuda_gosthash.cu # scrypt diff --git a/ccminer.cpp b/ccminer.cpp index 2ff384a..1598206 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -251,12 +251,7 @@ Options:\n\ dmd-gr Diamond-Groestl\n\ fresh Freshcoin (shavite 80)\n\ fugue256 Fuguecoin\n\ - groestl Groestlcoin\n\ - heavy Heavycoin\n\ - hmq1725 Doubloons / Espers\n\ - jackpot Jackpot\n\ - keccak Keccak-256 (Maxcoin)\n\ - gostd GOSTd (GOSTcoin)\n\ + gostd GOSTd (GOSTcoin)\n\ groestl Groestlcoin\n" #ifdef WITH_HEAVY_ALGO " heavy Heavycoin\n" @@ -1583,16 +1578,16 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work) for (i = 0; i < sctx->job.merkle_count; i++) { memcpy(merkle_root + 32, sctx->job.merkle[i], 32); -#ifdef WITH_HEAVY_ALGO - if (opt_algo == ALGO_HEAVY || opt_algo == ALGO_MJOLLNIR) - heavycoin_hash(merkle_root, merkle_root, 64); - else if (opt_algo == ALGO_GOSTD) + if (opt_algo == ALGO_GOSTD) { memcpy(merkle_root + 32, merkle_root, 32); gostd(merkle_root, merkle_root, 64); } - else +#ifdef WITH_HEAVY_ALGO + else if (opt_algo == ALGO_HEAVY || opt_algo == ALGO_MJOLLNIR) + heavycoin_hash(merkle_root, merkle_root, 64); #endif + else sha256d(merkle_root, merkle_root, 64); } @@ -3890,7 +3885,7 @@ int main(int argc, char *argv[]) CUDART_VERSION/1000, (CUDART_VERSION % 1000)/10, arch); printf(" Originally based on Christian Buchner and Christian H. project\n"); printf(" Include some kernels from alexis78, djm34, djEzo, tsiv and krnlx.\n\n"); - printf(" GOSTd algo by PurpleI2P team, ©2017. Donations are welcome to\n"); + printf(" GOSTd algo by PurpleI2P team, ©2017-2018. Donations are welcome to\n"); printf(" address GbD2JSQHBHCKLa9WTHmigJRpyFgmBj4woG. Thanks!\n\n"); printf("BTC donation address: 1AJdfCpLWPNoAMDfHF1wD5y8VgKSSTHxPo (tpruvot)\n\n"); } diff --git a/ccminer.vcxproj b/ccminer.vcxproj index 88e5e28..e85e3eb 100644 --- a/ccminer.vcxproj +++ b/ccminer.vcxproj @@ -112,7 +112,7 @@ 80 true true - compute_50,sm_50 + compute_52,sm_52 $(NVTOOLSEXT_PATH)\include;..\..\..\Common\C99 64 diff --git a/miner.h b/miner.h index 501e4c1..81d27c5 100644 --- a/miner.h +++ b/miner.h @@ -267,7 +267,6 @@ json_t * json_load_url(char* cfg_url, json_error_t *err); void sha256_init(uint32_t *state); void sha256_transform(uint32_t *state, const uint32_t *block, int swap); void sha256d(unsigned char *hash, const unsigned char *data, int len); - void gostd(void *output, const void *input, size_t len); #define HAVE_SHA256_4WAY 0 @@ -288,6 +287,7 @@ extern int scanhash_equihash(int thr_id, struct work* work, uint32_t max_nonce, extern int scanhash_keccak256(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); extern int scanhash_fresh(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); extern int scanhash_fugue256(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); +extern int scanhash_gostd(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); extern int scanhash_groestlcoin(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); extern int scanhash_hmq17(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); extern int scanhash_heavy(int thr_id,struct work *work, uint32_t max_nonce, unsigned long *hashes_done, uint32_t maxvote, int blocklen); @@ -311,7 +311,6 @@ extern int scanhash_sha256d(int thr_id, struct work *work, uint32_t max_nonce, u extern int scanhash_sha256t(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done); extern int scanhash_sia(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done); extern int scanhash_sib(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); -extern int scanhash_gostd(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); extern int scanhash_skeincoin(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); extern int scanhash_skein2(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done); extern int scanhash_skunk(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done); @@ -353,6 +352,7 @@ extern void free_equihash(int thr_id); extern void free_keccak256(int thr_id); extern void free_fresh(int thr_id); extern void free_fugue256(int thr_id); +extern void free_gostd(int thr_id); extern void free_groestlcoin(int thr_id); extern void free_heavy(int thr_id); extern void free_hmq17(int thr_id); @@ -374,7 +374,6 @@ extern void free_quark(int thr_id); extern void free_qubit(int thr_id); extern void free_sha256d(int thr_id); extern void free_sha256t(int thr_id); -extern void free_gostd(int thr_id); extern void free_sia(int thr_id); extern void free_sib(int thr_id); extern void free_skeincoin(int thr_id); @@ -898,6 +897,7 @@ void deephash(void *state, const void *input); void luffa_hash(void *state, const void *input); void fresh_hash(void *state, const void *input); void fugue256_hash(unsigned char* output, const unsigned char* input, int len); +void gostd_hash(void *output, const void *input); void heavycoin_hash(unsigned char* output, const unsigned char* input, int len); void hmq17hash(void *output, const void *input); void hsr_hash(void *output, const void *input); @@ -922,7 +922,6 @@ void scryptjane_hash(void* output, const void* input); void sha256d_hash(void *output, const void *input); void sha256t_hash(void *output, const void *input); void sibhash(void *output, const void *input); -void gostd_hash(void *output, const void *input); void skeincoinhash(void *output, const void *input); void skein2hash(void *output, const void *input); void skunk_hash(void *state, const void *input);