Skip to content

Commit

Permalink
cpu-miner: sort algos by name, show reject reason
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed Sep 1, 2014
1 parent bfe96c4 commit 1fb9bec
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 39 deletions.
54 changes: 27 additions & 27 deletions cpu-miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,16 @@ struct workio_cmd {
};

typedef enum {
ALGO_HEAVY, /* Heavycoin hash */
ALGO_MJOLLNIR, /* Mjollnir hash */
ALGO_ANIME,
ALGO_BLAKE,
ALGO_FRESH,
ALGO_FUGUE256, /* Fugue256 */
ALGO_GROESTL,
ALGO_MYR_GR,
ALGO_HEAVY, /* Heavycoin hash */
ALGO_JACKPOT,
ALGO_MJOLLNIR, /* Mjollnir hash */
ALGO_MYR_GR,
ALGO_QUARK,
ALGO_ANIME,
ALGO_FRESH,
ALGO_BLAKE,
ALGO_NIST5,
ALGO_WHC,
ALGO_X11,
Expand All @@ -147,17 +147,17 @@ typedef enum {
} sha256_algos;

static const char *algo_names[] = {
"heavy",
"mjollnir",
"anime",
"blake",
"fresh",
"fugue256",
"groestl",
"myr-gr",
"heavy",
"jackpot",
"quark",
"anime",
"fresh",
"blake",
"mjollnir",
"myr-gr",
"nist5",
"quark",
"whirl",
"x11",
"x13",
Expand Down Expand Up @@ -229,17 +229,17 @@ static char const usage[] = "\
Usage: " PROGRAM_NAME " [OPTIONS]\n\
Options:\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\
groestl Groestlcoin hash\n\
heavy Heavycoin hash\n\
jackpot Jackpot hash\n\
mjollnir Mjollnircoin hash\n\
groestl Groestlcoin 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\
quark Quark hash\n\
whirl Whirlcoin (old whirlpool)\n\
x11 X11 (DarkCoin) hash\n\
x13 X13 (MaruCoin) hash\n\
Expand Down Expand Up @@ -420,11 +420,11 @@ static void share_result(int result, const char *reason)
100. * accepted_count / (accepted_count + rejected_count),
s,
use_colors ?
(result ? CL_GRN "(yay!!!)" : CL_RED "(booooo)")
(result ? CL_GRN "yay!!!" : CL_RED "booooo")
: (result ? "(yay!!!)" : "(booooo)"));

if (opt_debug && reason)
applog(LOG_DEBUG, "DEBUG: reject reason: %s", reason);
if (reason)
applog(LOG_WARNING, "reject reason: %s", reason);
}

static bool submit_upstream_work(CURL *curl, struct work *work)
Expand Down Expand Up @@ -856,7 +856,7 @@ static void *miner_thread(void *userdata)
if ((*nonceptr) >= end_nonce)
stratum_gen_work(&stratum, &g_work);
} 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 */
pthread_mutex_lock(&g_work_lock);
if (!have_stratum &&
Expand Down Expand Up @@ -952,13 +952,13 @@ static void *miner_thread(void *userdata)
max_nonce, &hashes_done);
break;

case ALGO_BLAKE:
rc = scanhash_blake32(thr_id, work.data, work.target,
case ALGO_ANIME:
rc = scanhash_anime(thr_id, work.data, work.target,
max_nonce, &hashes_done);
break;

case ALGO_ANIME:
rc = scanhash_anime(thr_id, work.data, work.target,
case ALGO_BLAKE:
rc = scanhash_blake32(thr_id, work.data, work.target,
max_nonce, &hashes_done);
break;

Expand Down
7 changes: 4 additions & 3 deletions miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,14 @@ extern void tq_thaw(struct thread_q *tq);
void applog_hash(unsigned char *hash);

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 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 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 quarkhash(void *state, const void *input);
void wcoinhash(void *state, const void *input);
Expand Down
2 changes: 1 addition & 1 deletion quark/animecoin.cu
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extern void quark_compactTest_single_false_cpu_hash_64(int thr_id, int threads,
int order);

// 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_bmw512_context ctx_bmw;
Expand Down
20 changes: 12 additions & 8 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,18 @@ void print_hash_tests(void)

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);
fugue256_hash(&hash[0], &buf[0], 32);
printpfx("fugue256", hash);
Expand All @@ -1393,10 +1405,6 @@ void print_hash_tests(void)
myriadhash(&hash[0], &buf[0]);
printpfx("myriad", hash);

memset(hash, 0, sizeof hash);
blake32hash(&hash[0], &buf[0]);
printpfx("blake", hash);

memset(hash, 0, sizeof hash);
nist5hash(&hash[0], &buf[0]);
printpfx("nist5", hash);
Expand All @@ -1405,10 +1413,6 @@ void print_hash_tests(void)
quarkhash(&hash[0], &buf[0]);
printpfx("quark", hash);

memset(hash, 0, sizeof hash);
fresh_hash(&hash[0], &buf[0]);
printpfx("fresh", hash);

memset(hash, 0, sizeof hash);
wcoinhash(&hash[0], &buf[0]);
printpfx("whirl", hash);
Expand Down

0 comments on commit 1fb9bec

Please sign in to comment.