Browse Source

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

2upstream
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 { @@ -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,
@ -147,17 +147,17 @@ typedef enum { @@ -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",
@ -229,17 +229,17 @@ static char const usage[] = "\ @@ -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\
@ -420,11 +420,11 @@ static void share_result(int result, const char *reason) @@ -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)
@ -856,7 +856,7 @@ static void *miner_thread(void *userdata) @@ -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 &&
@ -952,13 +952,13 @@ static void *miner_thread(void *userdata) @@ -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;

7
miner.h

@ -400,13 +400,14 @@ extern void tq_thaw(struct thread_q *tq); @@ -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);

2
quark/animecoin.cu

@ -57,7 +57,7 @@ extern void quark_compactTest_single_false_cpu_hash_64(int thr_id, int threads, @@ -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;

20
util.c

@ -1373,6 +1373,18 @@ void print_hash_tests(void) @@ -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);
@ -1393,10 +1405,6 @@ void print_hash_tests(void) @@ -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);
@ -1405,10 +1413,6 @@ void print_hash_tests(void) @@ -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);

Loading…
Cancel
Save