Browse Source

cpu-miner: sort algos by name, show reject reason

master
Tanguy Pruvot 10 years ago
parent
commit
1fb9becc1f
  1. 54
      cpu-miner.c
  2. 7
      miner.h
  3. 2
      quark/animecoin.cu
  4. 20
      util.c

54
cpu-miner.c

@ -126,16 +126,16 @@ struct workio_cmd {
}; };
typedef enum { typedef enum {
ALGO_HEAVY, /* Heavycoin hash */ ALGO_ANIME,
ALGO_MJOLLNIR, /* Mjollnir hash */ ALGO_BLAKE,
ALGO_FRESH,
ALGO_FUGUE256, /* Fugue256 */ ALGO_FUGUE256, /* Fugue256 */
ALGO_GROESTL, ALGO_GROESTL,
ALGO_MYR_GR, ALGO_HEAVY, /* Heavycoin hash */
ALGO_JACKPOT, ALGO_JACKPOT,
ALGO_MJOLLNIR, /* Mjollnir hash */
ALGO_MYR_GR,
ALGO_QUARK, ALGO_QUARK,
ALGO_ANIME,
ALGO_FRESH,
ALGO_BLAKE,
ALGO_NIST5, ALGO_NIST5,
ALGO_WHC, ALGO_WHC,
ALGO_X11, ALGO_X11,
@ -147,17 +147,17 @@ typedef enum {
} sha256_algos; } sha256_algos;
static const char *algo_names[] = { static const char *algo_names[] = {
"heavy", "anime",
"mjollnir", "blake",
"fresh",
"fugue256", "fugue256",
"groestl", "groestl",
"myr-gr", "heavy",
"jackpot", "jackpot",
"quark", "mjollnir",
"anime", "myr-gr",
"fresh",
"blake",
"nist5", "nist5",
"quark",
"whirl", "whirl",
"x11", "x11",
"x13", "x13",
@ -229,17 +229,17 @@ static char const usage[] = "\
Usage: " PROGRAM_NAME " [OPTIONS]\n\ Usage: " PROGRAM_NAME " [OPTIONS]\n\
Options:\n\ Options:\n\
-a, --algo=ALGO specify the algorithm to use\n\ -a, --algo=ALGO specify the algorithm to use\n\
anime Animecoin hash\n\
blake Blake 256 (like NEOS blake)\n\
fresh Freshcoin hash (shavite 80)\n\
fugue256 Fuguecoin hash\n\ fugue256 Fuguecoin hash\n\
groestl Groestlcoin hash\n\
heavy Heavycoin hash\n\ heavy Heavycoin hash\n\
jackpot Jackpot hash\n\
mjollnir Mjollnircoin hash\n\ mjollnir Mjollnircoin hash\n\
groestl Groestlcoin hash\n\
myr-gr Myriad-Groestl hash\n\ myr-gr Myriad-Groestl hash\n\
jackpot Jackpot hash\n\
quark Quark hash\n\
anime Animecoin hash\n\
blake Blake 256 (like NEOS blake)\n\
fresh Freshcoin hash (shavite 80)\n\
nist5 NIST5 (TalkCoin) hash\n\ nist5 NIST5 (TalkCoin) hash\n\
quark Quark hash\n\
whirl Whirlcoin (old whirlpool)\n\ whirl Whirlcoin (old whirlpool)\n\
x11 X11 (DarkCoin) hash\n\ x11 X11 (DarkCoin) hash\n\
x13 X13 (MaruCoin) hash\n\ x13 X13 (MaruCoin) hash\n\
@ -420,11 +420,11 @@ static void share_result(int result, const char *reason)
100. * accepted_count / (accepted_count + rejected_count), 100. * accepted_count / (accepted_count + rejected_count),
s, s,
use_colors ? use_colors ?
(result ? CL_GRN "(yay!!!)" : CL_RED "(booooo)") (result ? CL_GRN "yay!!!" : CL_RED "booooo")
: (result ? "(yay!!!)" : "(booooo)")); : (result ? "(yay!!!)" : "(booooo)"));
if (opt_debug && reason) if (reason)
applog(LOG_DEBUG, "DEBUG: reject reason: %s", reason); applog(LOG_WARNING, "reject reason: %s", reason);
} }
static bool submit_upstream_work(CURL *curl, struct work *work) static bool submit_upstream_work(CURL *curl, struct work *work)
@ -856,7 +856,7 @@ static void *miner_thread(void *userdata)
if ((*nonceptr) >= end_nonce) if ((*nonceptr) >= end_nonce)
stratum_gen_work(&stratum, &g_work); stratum_gen_work(&stratum, &g_work);
} else { } else {
int min_scantime = have_longpoll ? LP_SCANTIME : opt_scantime; int min_scantime = have_longpoll ? (LP_SCANTIME*3)/4 : opt_scantime;
/* obtain new work from internal workio thread */ /* obtain new work from internal workio thread */
pthread_mutex_lock(&g_work_lock); pthread_mutex_lock(&g_work_lock);
if (!have_stratum && if (!have_stratum &&
@ -952,13 +952,13 @@ static void *miner_thread(void *userdata)
max_nonce, &hashes_done); max_nonce, &hashes_done);
break; break;
case ALGO_BLAKE: case ALGO_ANIME:
rc = scanhash_blake32(thr_id, work.data, work.target, rc = scanhash_anime(thr_id, work.data, work.target,
max_nonce, &hashes_done); max_nonce, &hashes_done);
break; break;
case ALGO_ANIME: case ALGO_BLAKE:
rc = scanhash_anime(thr_id, work.data, work.target, rc = scanhash_blake32(thr_id, work.data, work.target,
max_nonce, &hashes_done); max_nonce, &hashes_done);
break; break;

7
miner.h

@ -400,13 +400,14 @@ extern void tq_thaw(struct thread_q *tq);
void applog_hash(unsigned char *hash); void applog_hash(unsigned char *hash);
void print_hash_tests(void); void print_hash_tests(void);
unsigned int jackpothash(void *state, const void *input); void animehash(void *state, const void *input);
void blake32hash(void *output, const void *input);
void fresh_hash(void *state, const void *input);
void fugue256_hash(unsigned char* output, const unsigned char* input, int len); void fugue256_hash(unsigned char* output, const unsigned char* input, int len);
void heavycoin_hash(unsigned char* output, const unsigned char* input, int len); void heavycoin_hash(unsigned char* output, const unsigned char* input, int len);
unsigned int jackpothash(void *state, const void *input);
void groestlhash(void *state, const void *input); void groestlhash(void *state, const void *input);
void myriadhash(void *state, const void *input); void myriadhash(void *state, const void *input);
void fresh_hash(void *state, const void *input);
void blake32hash(void *output, const void *input);
void nist5hash(void *state, const void *input); void nist5hash(void *state, const void *input);
void quarkhash(void *state, const void *input); void quarkhash(void *state, const void *input);
void wcoinhash(void *state, const void *input); void wcoinhash(void *state, const void *input);

2
quark/animecoin.cu

@ -57,7 +57,7 @@ extern void quark_compactTest_single_false_cpu_hash_64(int thr_id, int threads,
int order); int order);
// Original Quarkhash Funktion aus einem miner Quelltext // Original Quarkhash Funktion aus einem miner Quelltext
inline void animehash(void *state, const void *input) extern "C" void animehash(void *state, const void *input)
{ {
sph_blake512_context ctx_blake; sph_blake512_context ctx_blake;
sph_bmw512_context ctx_bmw; sph_bmw512_context ctx_bmw;

20
util.c

@ -1373,6 +1373,18 @@ void print_hash_tests(void)
printf(CL_WHT "CPU HASH ON EMPTY BUFFER RESULTS:" CL_N "\n"); printf(CL_WHT "CPU HASH ON EMPTY BUFFER RESULTS:" CL_N "\n");
memset(hash, 0, sizeof hash);
animehash(&hash[0], &buf[0]);
printpfx("anime", hash);
memset(hash, 0, sizeof hash);
blake32hash(&hash[0], &buf[0]);
printpfx("blake", hash);
memset(hash, 0, sizeof hash);
fresh_hash(&hash[0], &buf[0]);
printpfx("fresh", hash);
memset(hash, 0, sizeof hash); memset(hash, 0, sizeof hash);
fugue256_hash(&hash[0], &buf[0], 32); fugue256_hash(&hash[0], &buf[0], 32);
printpfx("fugue256", hash); printpfx("fugue256", hash);
@ -1393,10 +1405,6 @@ void print_hash_tests(void)
myriadhash(&hash[0], &buf[0]); myriadhash(&hash[0], &buf[0]);
printpfx("myriad", hash); printpfx("myriad", hash);
memset(hash, 0, sizeof hash);
blake32hash(&hash[0], &buf[0]);
printpfx("blake", hash);
memset(hash, 0, sizeof hash); memset(hash, 0, sizeof hash);
nist5hash(&hash[0], &buf[0]); nist5hash(&hash[0], &buf[0]);
printpfx("nist5", hash); printpfx("nist5", hash);
@ -1405,10 +1413,6 @@ void print_hash_tests(void)
quarkhash(&hash[0], &buf[0]); quarkhash(&hash[0], &buf[0]);
printpfx("quark", hash); printpfx("quark", hash);
memset(hash, 0, sizeof hash);
fresh_hash(&hash[0], &buf[0]);
printpfx("fresh", hash);
memset(hash, 0, sizeof hash); memset(hash, 0, sizeof hash);
wcoinhash(&hash[0], &buf[0]); wcoinhash(&hash[0], &buf[0]);
printpfx("whirl", hash); printpfx("whirl", hash);

Loading…
Cancel
Save